All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org
Subject: Re: [PATCH] rtc: pic32: Add error handling in pic32_rtc_probe()
Date: Tue, 22 Nov 2022 14:47:20 +0100	[thread overview]
Message-ID: <Y3zS6BryxxQJDcT0@mail.local> (raw)
In-Reply-To: <20221122121721.1647168-1-cuigaosheng1@huawei.com>

On 22/11/2022 20:17:21+0800, Gaosheng Cui wrote:
> The pic32_rtc_enable(pdata, 0) and clk_disable_unprepare(pdata->clk)
> should be called in the error handling of devm_rtc_allocate_device(),
> fix it.
> 
> Fixes: 6515e23b9fde ("rtc: pic32: convert to devm_rtc_allocate_device")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/rtc/rtc-pic32.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-pic32.c b/drivers/rtc/rtc-pic32.c
> index 7fb9145c43bd..258136e3fe96 100644
> --- a/drivers/rtc/rtc-pic32.c
> +++ b/drivers/rtc/rtc-pic32.c
> @@ -331,8 +331,10 @@ static int pic32_rtc_probe(struct platform_device *pdev)
>  	device_init_wakeup(&pdev->dev, 1);
>  
>  	pdata->rtc = devm_rtc_allocate_device(&pdev->dev);

A better solution is to move this call earlier in .probe

> -	if (IS_ERR(pdata->rtc))
> -		return PTR_ERR(pdata->rtc);
> +	if (IS_ERR(pdata->rtc)) {
> +		ret = PTR_ERR(pdata->rtc);
> +		goto err_nortc;
> +	}
>  
>  	pdata->rtc->ops = &pic32_rtcops;
>  	pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
> -- 
> 2.25.1
> 

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

      reply	other threads:[~2022-11-22 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 12:17 [PATCH] rtc: pic32: Add error handling in pic32_rtc_probe() Gaosheng Cui
2022-11-22 13:47 ` Alexandre Belloni [this message]

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=Y3zS6BryxxQJDcT0@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=cuigaosheng1@huawei.com \
    --cc=linux-rtc@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.