watchdog: sa11x0/pxa: fix error path of driver initialization
authorVladimir Zapolskiy <vz@mleia.com>
Wed, 21 Dec 2016 01:18:16 +0000 (03:18 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 24 Feb 2017 22:00:23 +0000 (14:00 -0800)
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>
drivers/watchdog/sa1100_wdt.c

index 8965e3f536c3572516053c522eb1d4208309988a..d3be4f831db58a22cee4e868920923ad3bc5612d 100644 (file)
@@ -188,12 +188,14 @@ static int __init sa1100dog_init(void)
        pre_margin = oscr_freq * margin;
 
        ret = misc_register(&sa1100dog_miscdev);
-       if (ret == 0)
+       if (ret == 0) {
                pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
                        margin);
-       return ret;
-err:
+               return 0;
+       }
+
        clk_disable_unprepare(clk);
+err:
        clk_put(clk);
        return ret;
 }