All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/etnaviv: check for errors when enabling clocks
@ 2016-08-21 22:32 Fabio Estevam
  2016-08-21 22:32 ` [PATCH 2/3] drm/etnaviv: remove unneeded 'fail' label Fabio Estevam
  2016-08-21 22:32 ` [PATCH 3/3] drm/etnaviv: remove unneeded variable initialization Fabio Estevam
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-08-21 22:32 UTC (permalink / raw)
  To: l.stach; +Cc: dri-devel, linux+etnaviv

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>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 87ef341..efee7d47 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;
 }
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-22  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-21 22:32 [PATCH 1/3] drm/etnaviv: check for errors when enabling clocks Fabio Estevam
2016-08-21 22:32 ` [PATCH 2/3] drm/etnaviv: remove unneeded 'fail' label Fabio Estevam
2016-08-21 22:32 ` [PATCH 3/3] drm/etnaviv: remove unneeded variable initialization Fabio Estevam
2016-08-22  9:29   ` Lucas Stach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.