All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, codrin.ciubotariu@microchip.com,
	claudiu.beznea@microchip.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] misc: atmel-ssc: Handle error for clk_prepare_enable
Date: Wed, 2 Mar 2022 10:48:57 +0100	[thread overview]
Message-ID: <Yh89idAr6BiqqdaM@piout.net> (raw)
In-Reply-To: <20220302084319.96435-1-jiasheng@iscas.ac.cn>

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

this will never ever fail, this patch doesn't fix any actual issue

> Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/misc/atmel-ssc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index d6cd5537126c..c76ca234af4b 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -192,6 +192,7 @@ static int ssc_probe(struct platform_device *pdev)
>  	struct resource *regs;
>  	struct ssc_device *ssc;
>  	const struct atmel_ssc_platform_data *plat_dat;
> +	int ret;
>  
>  	ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL);
>  	if (!ssc) {
> @@ -226,7 +227,10 @@ static int ssc_probe(struct platform_device *pdev)
>  	}
>  
>  	/* disable all interrupts */
> -	clk_prepare_enable(ssc->clk);
> +	ret = clk_prepare_enable(ssc->clk);
> +	if (ret)
> +		return ret;
> +
>  	ssc_writel(ssc->regs, IDR, -1);
>  	ssc_readl(ssc->regs, SR);
>  	clk_disable_unprepare(ssc->clk);
> -- 
> 2.25.1
> 

-- 
Alexandre Belloni, co-owner and COO, 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

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: codrin.ciubotariu@microchip.com, arnd@arndb.de,
	gregkh@linuxfoundation.org, nicolas.ferre@microchip.com,
	claudiu.beznea@microchip.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] misc: atmel-ssc: Handle error for clk_prepare_enable
Date: Wed, 2 Mar 2022 10:48:57 +0100	[thread overview]
Message-ID: <Yh89idAr6BiqqdaM@piout.net> (raw)
In-Reply-To: <20220302084319.96435-1-jiasheng@iscas.ac.cn>

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

this will never ever fail, this patch doesn't fix any actual issue

> Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/misc/atmel-ssc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index d6cd5537126c..c76ca234af4b 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -192,6 +192,7 @@ static int ssc_probe(struct platform_device *pdev)
>  	struct resource *regs;
>  	struct ssc_device *ssc;
>  	const struct atmel_ssc_platform_data *plat_dat;
> +	int ret;
>  
>  	ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL);
>  	if (!ssc) {
> @@ -226,7 +227,10 @@ static int ssc_probe(struct platform_device *pdev)
>  	}
>  
>  	/* disable all interrupts */
> -	clk_prepare_enable(ssc->clk);
> +	ret = clk_prepare_enable(ssc->clk);
> +	if (ret)
> +		return ret;
> +
>  	ssc_writel(ssc->regs, IDR, -1);
>  	ssc_readl(ssc->regs, SR);
>  	clk_disable_unprepare(ssc->clk);
> -- 
> 2.25.1
> 

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

  reply	other threads:[~2022-03-02  9:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02  8:43 [PATCH] misc: atmel-ssc: Handle error for clk_prepare_enable Jiasheng Jiang
2022-03-02  8:43 ` Jiasheng Jiang
2022-03-02  9:48 ` Alexandre Belloni [this message]
2022-03-02  9:48   ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yh89idAr6BiqqdaM@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=claudiu.beznea@microchip.com \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiasheng@iscas.ac.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.