Re: [PATCH] atmel: fix a missing check of clk_prepare

From
Alexandre Belloni <alexandre.belloni@bootlin.com>
Date
2018-12-26 08:32:28
Also in
lkml
Reply to
Kangjie Lu, 2018-12-26
Hi,

On 25/12/2018 20:54:05-0600, Kangjie Lu wrote:
quoted hunk ↗ jump to hunk
clk_prepare() could fail, so let's check its status, and if it fails,
issue an error message.

Signed-off-by: Kangjie Lu <redacted>
---
 drivers/misc/atmel-ssc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index d8e3cc2dc747..9e69d0585f49 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -60,7 +60,8 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
 	ssc->user++;
 	spin_unlock(&user_lock);
 
-	clk_prepare(ssc->clk);
+	if (clk_prepare(ssc->clk))
+		pr_err("ssc: failed to prepare clk.\n");
 
There is no point in adding this check and yet another string to please
a static analysis tool. This is especially true because clk_prepare will
never actually fail else you wouldn't reach this code anyway.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (2 messages) 2 messages, 2 authors, last reply 2018-12-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help