Skip to content

Commit 90cd5c8

Browse files
gscuialexandrebelloni
authored andcommitted
rtc: pic32: Move devm_rtc_allocate_device earlier in pic32_rtc_probe()
The pic32_rtc_enable(pdata, 0) and clk_disable_unprepare(pdata->clk) should be called in the error handling of devm_rtc_allocate_device(), so we should move devm_rtc_allocate_device earlier in pic32_rtc_probe() to fix it. Fixes: 6515e23 ("rtc: pic32: convert to devm_rtc_allocate_device") Signed-off-by: Gaosheng Cui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 5fb733d commit 90cd5c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/rtc/rtc-pic32.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,16 @@ static int pic32_rtc_probe(struct platform_device *pdev)
324324

325325
spin_lock_init(&pdata->alarm_lock);
326326

327+
pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
328+
if (IS_ERR(pdata->rtc))
329+
return PTR_ERR(pdata->rtc);
330+
327331
clk_prepare_enable(pdata->clk);
328332

329333
pic32_rtc_enable(pdata, 1);
330334

331335
device_init_wakeup(&pdev->dev, 1);
332336

333-
pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
334-
if (IS_ERR(pdata->rtc))
335-
return PTR_ERR(pdata->rtc);
336-
337337
pdata->rtc->ops = &pic32_rtcops;
338338
pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
339339
pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;

0 commit comments

Comments
 (0)