Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: sa11x0/pxa: fix error path of driver initialization

The change corrects release of captured resources on error path, namely
the clock is disabled and put if misc device registration fails and not
enabled clock is not disabled now.

Fixes: 6924089c488e ("watchdog: sa11x0/pxa: get rid of get_clock_tick_rate")
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Vladimir Zapolskiy and committed by
Guenter Roeck
027d89d9 f3519a66

+5 -3
+5 -3
drivers/watchdog/sa1100_wdt.c
··· 188 188 pre_margin = oscr_freq * margin; 189 189 190 190 ret = misc_register(&sa1100dog_miscdev); 191 - if (ret == 0) 191 + if (ret == 0) { 192 192 pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", 193 193 margin); 194 - return ret; 195 - err: 194 + return 0; 195 + } 196 + 196 197 clk_disable_unprepare(clk); 198 + err: 197 199 clk_put(clk); 198 200 return ret; 199 201 }