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@xxxxxxxxxx> > --- > 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