diff options
author | Fabio Estevam <festevam@gmail.com> | 2016-08-21 19:32:13 -0300 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2016-09-15 15:29:29 +0200 |
commit | 9e59eea66f9601b3d497abcbb5010a760567b7cf (patch) | |
tree | 84be5e2fa2ee8dd851c135f659bf874782416073 /drivers/gpu/drm/etnaviv | |
parent | d9853490176c88fff71d03ec9a174b77011f5026 (diff) | |
download | talos-op-linux-9e59eea66f9601b3d497abcbb5010a760567b7cf.tar.gz talos-op-linux-9e59eea66f9601b3d497abcbb5010a760567b7cf.zip |
drm/etnaviv: check for errors when enabling clocks
clk_prepare_enable() may fail, so we should better check for its return
value and propagate it in the case of failure.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/etnaviv')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index b382cf505262..666f3d13706e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -872,12 +872,25 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m) */ static int enable_clk(struct etnaviv_gpu *gpu) { - if (gpu->clk_core) - clk_prepare_enable(gpu->clk_core); - if (gpu->clk_shader) - clk_prepare_enable(gpu->clk_shader); + int ret; + + if (gpu->clk_core) { + ret = clk_prepare_enable(gpu->clk_core); + if (ret) + return ret; + } + + if (gpu->clk_shader) { + ret = clk_prepare_enable(gpu->clk_shader); + if (ret) + goto disable_clk_core; + } return 0; + +disable_clk_core: + clk_disable_unprepare(gpu->clk_core); + return ret; } static int disable_clk(struct etnaviv_gpu *gpu) @@ -892,8 +905,13 @@ static int disable_clk(struct etnaviv_gpu *gpu) static int enable_axi(struct etnaviv_gpu *gpu) { - if (gpu->clk_bus) - clk_prepare_enable(gpu->clk_bus); + int ret; + + if (gpu->clk_bus) { + ret = clk_prepare_enable(gpu->clk_bus); + if (ret) + return ret; + } return 0; } |