lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yh89O1sofdmcN/BR@piout.net>
Date:   Wed, 2 Mar 2022 10:47:39 +0100
From:   Alexandre Belloni <alexandre.belloni@...tlin.com>
To:     Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc:     codrin.ciubotariu@...rochip.com, arnd@...db.de,
        gregkh@...uxfoundation.org, nicolas.ferre@...rochip.com,
        claudiu.beznea@...rochip.com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] misc: atmel-ssc: Handle error for clk_prepare

On 02/03/2022 16:49:02+0800, Jiasheng Jiang wrote:
> As the potential failure of the clk_prepare(),
> it should be better to check it and return error if fails.
> 

This will never ever fail, this doesn't fix anything

> Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
>  drivers/misc/atmel-ssc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index d6cd5537126c..e0207e837e35 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -25,7 +25,7 @@ static LIST_HEAD(ssc_list);
>  
>  struct ssc_device *ssc_request(unsigned int ssc_num)
>  {
> -	int ssc_valid = 0;
> +	int ssc_valid = 0, ret;
>  	struct ssc_device *ssc;
>  
>  	mutex_lock(&user_lock);
> @@ -57,7 +57,9 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
>  	ssc->user++;
>  	mutex_unlock(&user_lock);
>  
> -	clk_prepare(ssc->clk);
> +	ret = clk_prepare(ssc->clk);
> +	if (ret)
> +		return ret;
>  
>  	return ssc;
>  }
> -- 
> 2.25.1
> 

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

Powered by blists - more mailing lists