Commit f2eef045 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Alexandre Belloni

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: c4f07ece ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer")
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 4fbd8d19
...@@ -253,7 +253,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) ...@@ -253,7 +253,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0, ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0,
"brcmstb-waketimer", timer); "brcmstb-waketimer", timer);
if (ret < 0) if (ret < 0)
return ret; goto err_clk;
timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot; timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot;
register_reboot_notifier(&timer->reboot_notifier); register_reboot_notifier(&timer->reboot_notifier);
...@@ -262,12 +262,21 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) ...@@ -262,12 +262,21 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
&brcmstb_waketmr_ops, THIS_MODULE); &brcmstb_waketmr_ops, THIS_MODULE);
if (IS_ERR(timer->rtc)) { if (IS_ERR(timer->rtc)) {
dev_err(dev, "unable to register device\n"); dev_err(dev, "unable to register device\n");
unregister_reboot_notifier(&timer->reboot_notifier); ret = PTR_ERR(timer->rtc);
return PTR_ERR(timer->rtc); goto err_notifier;
} }
dev_info(dev, "registered, with irq %d\n", timer->irq); dev_info(dev, "registered, with irq %d\n", timer->irq);
return 0;
err_notifier:
unregister_reboot_notifier(&timer->reboot_notifier);
err_clk:
if (timer->clk)
clk_disable_unprepare(timer->clk);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment