Commit 5db7e1bb authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Greg Kroah-Hartman

watchdog: davinci_wdt: fix error handling in davinci_wdt_probe()

[ Upstream commit d66e5364 ]

clk_disable_unprepare() was added to one error path,
but there is another one. The patch makes sure clk is
disabled at the both of them.

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fc7bcbb9
......@@ -198,15 +198,22 @@ static int davinci_wdt_probe(struct platform_device *pdev)
wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
if (IS_ERR(davinci_wdt->base))
return PTR_ERR(davinci_wdt->base);
if (IS_ERR(davinci_wdt->base)) {
ret = PTR_ERR(davinci_wdt->base);
goto err_clk_disable;
}
ret = watchdog_register_device(wdd);
if (ret < 0) {
clk_disable_unprepare(davinci_wdt->clk);
if (ret) {
dev_err(dev, "cannot register watchdog device\n");
goto err_clk_disable;
}
return 0;
err_clk_disable:
clk_disable_unprepare(davinci_wdt->clk);
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