diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2017-11-17 16:15:58 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-11-29 16:11:13 -0500 |
commit | f2eef045de9defbc6fc6b72b17f0941cbe26c81d (patch) | |
tree | b4281bfd081a6aede1d53e3267ae796f75bf2b66 | |
parent | 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323 (diff) |
rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe()
brcmstb_waketmr_probe() does not disable timer->clk on error paths.
Found by Linux Driver Verification project (linuxtesting.org).
Fixes: c4f07ecee22e ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer")
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | drivers/rtc/rtc-brcmstb-waketimer.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c index 796ac792a381..6cee61201c30 100644 --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c | |||
@@ -253,7 +253,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) | |||
253 | ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0, | 253 | ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0, |
254 | "brcmstb-waketimer", timer); | 254 | "brcmstb-waketimer", timer); |
255 | if (ret < 0) | 255 | if (ret < 0) |
256 | return ret; | 256 | goto err_clk; |
257 | 257 | ||
258 | timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot; | 258 | timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot; |
259 | register_reboot_notifier(&timer->reboot_notifier); | 259 | register_reboot_notifier(&timer->reboot_notifier); |
@@ -262,12 +262,21 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) | |||
262 | &brcmstb_waketmr_ops, THIS_MODULE); | 262 | &brcmstb_waketmr_ops, THIS_MODULE); |
263 | if (IS_ERR(timer->rtc)) { | 263 | if (IS_ERR(timer->rtc)) { |
264 | dev_err(dev, "unable to register device\n"); | 264 | dev_err(dev, "unable to register device\n"); |
265 | unregister_reboot_notifier(&timer->reboot_notifier); | 265 | ret = PTR_ERR(timer->rtc); |
266 | return PTR_ERR(timer->rtc); | 266 | goto err_notifier; |
267 | } | 267 | } |
268 | 268 | ||
269 | dev_info(dev, "registered, with irq %d\n", timer->irq); | 269 | dev_info(dev, "registered, with irq %d\n", timer->irq); |
270 | 270 | ||
271 | return 0; | ||
272 | |||
273 | err_notifier: | ||
274 | unregister_reboot_notifier(&timer->reboot_notifier); | ||
275 | |||
276 | err_clk: | ||
277 | if (timer->clk) | ||
278 | clk_disable_unprepare(timer->clk); | ||
279 | |||
271 | return ret; | 280 | return ret; |
272 | } | 281 | } |
273 | 282 | ||