From 027d89d96b6833f37091d858b9dcf92cd9b19aa7 Mon Sep 17 00:00:00 2001 From: Vladimir Zapolskiy Date: Wed, 21 Dec 2016 03:18:16 +0200 Subject: 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 Acked-by: Robert Jarzmik Reviewed-by: Guenter Roeck Acked-by: Russell King Signed-off-by: Guenter Roeck --- drivers/watchdog/sa1100_wdt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index 8965e3f536c3..d3be4f831db5 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c @@ -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; } -- cgit v1.2.3