Skip to content

Commit

Permalink
rtc: ls1x: remove useless label and goto
Browse files Browse the repository at this point in the history
The error handling in ls1x_rtc_probe used to release resources but since
it is using devm functions, it only returns a value. Make the code clearer
by returning directly instead of using goto.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
  • Loading branch information
Alexandre Belloni committed May 17, 2018
1 parent 52f0e7b commit 14dc3ec
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/rtc/rtc-ls1x.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,13 @@ static int ls1x_rtc_probe(struct platform_device *pdev)
{
struct rtc_device *rtcdev;
unsigned long v;
int ret;

v = readl(SYS_COUNTER_CNTRL);
if (!(v & RTC_CNTR_OK)) {
dev_err(&pdev->dev, "rtc counters not working\n");
ret = -ENODEV;
goto err;
return -ENODEV;
}
ret = -ETIMEDOUT;

/* set to 1 HZ if needed */
if (readl(SYS_TOYTRIM) != 32767) {
v = 0x100000;
Expand All @@ -165,7 +163,7 @@ static int ls1x_rtc_probe(struct platform_device *pdev)

if (!v) {
dev_err(&pdev->dev, "time out\n");
goto err;
return -ETIMEDOUT;
}
writel(32767, SYS_TOYTRIM);
}
Expand All @@ -181,9 +179,6 @@ static int ls1x_rtc_probe(struct platform_device *pdev)
rtcdev->ops = &ls1x_rtc_ops;

return rtc_register_device(rtcdev);

err:
return ret;
}

static struct platform_driver ls1x_rtc_driver = {
Expand Down

0 comments on commit 14dc3ec

Please sign in to comment.