public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmel: fix a missing check of clk_prepare
@ 2018-12-26  2:54 Kangjie Lu
  2018-12-26  8:32 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26  2:54 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Nicolas Ferre, Arnd Bergmann, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches, linux-arm-kernel,
	linux-kernel

clk_prepare() could fail, so let's check its status, and if it fails,
issue an error message.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 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");
 
 	return ssc;
 }
-- 
2.17.2 (Apple Git-113)


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

* Re: [PATCH] atmel: fix a missing check of clk_prepare
  2018-12-26  2:54 [PATCH] atmel: fix a missing check of clk_prepare Kangjie Lu
@ 2018-12-26  8:32 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2018-12-26  8:32 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Nicolas Ferre, Arnd Bergmann, Greg Kroah-Hartman,
	Ludovic Desroches, linux-arm-kernel, linux-kernel

Hi,

On 25/12/2018 20:54:05-0600, Kangjie Lu wrote:
> clk_prepare() could fail, so let's check its status, and if it fails,
> issue an error message.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  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

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

end of thread, other threads:[~2018-12-26  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26  2:54 [PATCH] atmel: fix a missing check of clk_prepare Kangjie Lu
2018-12-26  8:32 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox