Skip to content

Commit

Permalink
rtc: pic32: Move devm_rtc_allocate_device earlier in pic32_rtc_probe()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
gscui authored and alexandrebelloni committed Dec 10, 2022
1 parent 5fb733d commit 90cd5c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/rtc/rtc-pic32.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ static int pic32_rtc_probe(struct platform_device *pdev)

spin_lock_init(&pdata->alarm_lock);

pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(pdata->rtc))
return PTR_ERR(pdata->rtc);

clk_prepare_enable(pdata->clk);

pic32_rtc_enable(pdata, 1);

device_init_wakeup(&pdev->dev, 1);

pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(pdata->rtc))
return PTR_ERR(pdata->rtc);

pdata->rtc->ops = &pic32_rtcops;
pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
Expand Down

0 comments on commit 90cd5c8

Please sign in to comment.