Skip to content

Commit 5db7e1b

Browse files
khoroshilovgregkh
authored andcommitted
watchdog: davinci_wdt: fix error handling in davinci_wdt_probe()
[ Upstream commit d66e536 ] 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: Alexey Khoroshilov <khoroshilov@ispras.ru> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fc7bcbb commit 5db7e1b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎drivers/watchdog/davinci_wdt.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,22 @@ static int davinci_wdt_probe(struct platform_device *pdev)
198198

199199
wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
200200
davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
201-
if (IS_ERR(davinci_wdt->base))
202-
return PTR_ERR(davinci_wdt->base);
201+
if (IS_ERR(davinci_wdt->base)) {
202+
ret = PTR_ERR(davinci_wdt->base);
203+
goto err_clk_disable;
204+
}
203205

204206
ret = watchdog_register_device(wdd);
205-
if (ret < 0) {
206-
clk_disable_unprepare(davinci_wdt->clk);
207+
if (ret) {
207208
dev_err(dev, "cannot register watchdog device\n");
209+
goto err_clk_disable;
208210
}
209211

212+
return 0;
213+
214+
err_clk_disable:
215+
clk_disable_unprepare(davinci_wdt->clk);
216+
210217
return ret;
211218
}
212219

0 commit comments

Comments
 (0)