All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization
@ 2016-12-21  1:18 Vladimir Zapolskiy
  2016-12-21  7:20 ` Robert Jarzmik
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Zapolskiy @ 2016-12-21  1:18 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Robert Jarzmik
  Cc: Russell King, linux-watchdog

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>
---
 drivers/watchdog/sa1100_wdt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index 8965e3f..d3be4f8 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;
 }
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization
  2016-12-21  1:18 [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization Vladimir Zapolskiy
@ 2016-12-21  7:20 ` Robert Jarzmik
  2016-12-23  1:57 ` Guenter Roeck
  2017-01-02 12:48 ` Russell King - ARM Linux
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Jarzmik @ 2016-12-21  7:20 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Wim Van Sebroeck, Guenter Roeck, Russell King, linux-watchdog

Vladimir Zapolskiy <vz@mleia.com> writes:

> 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.

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

Cheers.

-- 
Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization
  2016-12-21  1:18 [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization Vladimir Zapolskiy
  2016-12-21  7:20 ` Robert Jarzmik
@ 2016-12-23  1:57 ` Guenter Roeck
  2017-01-02 12:48 ` Russell King - ARM Linux
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2016-12-23  1:57 UTC (permalink / raw)
  To: Vladimir Zapolskiy, Wim Van Sebroeck, Robert Jarzmik
  Cc: Russell King, linux-watchdog

On 12/20/2016 05:18 PM, Vladimir Zapolskiy wrote:
> 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>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/sa1100_wdt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
> index 8965e3f..d3be4f8 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;
>  }
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization
  2016-12-21  1:18 [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization Vladimir Zapolskiy
  2016-12-21  7:20 ` Robert Jarzmik
  2016-12-23  1:57 ` Guenter Roeck
@ 2017-01-02 12:48 ` Russell King - ARM Linux
  2 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2017-01-02 12:48 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Wim Van Sebroeck, Guenter Roeck, Robert Jarzmik, linux-watchdog

On Wed, Dec 21, 2016 at 03:18:16AM +0200, Vladimir Zapolskiy wrote:
> 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>

Looks correct to me, thanks.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

> ---
>  drivers/watchdog/sa1100_wdt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
> index 8965e3f..d3be4f8 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;
>  }
> -- 
> 2.10.2
> 

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-02 12:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21  1:18 [PATCH] watchdog: sa11x0/pxa: fix error path of driver initialization Vladimir Zapolskiy
2016-12-21  7:20 ` Robert Jarzmik
2016-12-23  1:57 ` Guenter Roeck
2017-01-02 12:48 ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.