linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: fsl_get_sys_freq() failure not noticed
@ 2009-03-03 14:10 Roel Kluin
  2009-03-05  8:47 ` Wim Van Sebroeck
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-03-03 14:10 UTC (permalink / raw)
  To: wim; +Cc: lkml, Andrew Morton

Maybe it is nicer to do a test like:

	if (freq < MAX_FREQ)

but I don't know what MAX_FREQ should be.
------------------------------>8-------------8<---------------------------------
fsl_get_sys_freq() may return -1 when 'soc' isn't found, but in gef_wdt_probe()
'freq' is unsigned, so the test doesn't catch that.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index f0c2b7a..734d980 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -269,7 +269,7 @@ static int __devinit gef_wdt_probe(struct of_device *dev,
 	bus_clk = 133; /* in MHz */
 
 	freq = fsl_get_sys_freq();
-	if (freq > 0)
+	if (freq != -1)
 		bus_clk = freq;
 
 	/* Map devices registers into memory */

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

* Re: [PATCH] watchdog: fsl_get_sys_freq() failure not noticed
  2009-03-03 14:10 [PATCH] watchdog: fsl_get_sys_freq() failure not noticed Roel Kluin
@ 2009-03-05  8:47 ` Wim Van Sebroeck
  0 siblings, 0 replies; 2+ messages in thread
From: Wim Van Sebroeck @ 2009-03-05  8:47 UTC (permalink / raw)
  To: Roel Kluin; +Cc: wim, lkml, Andrew Morton

Hi Roel,

> Maybe it is nicer to do a test like:
> 
> 	if (freq < MAX_FREQ)
> 
> but I don't know what MAX_FREQ should be.
> ------------------------------>8-------------8<---------------------------------
> fsl_get_sys_freq() may return -1 when 'soc' isn't found, but in gef_wdt_probe()
> 'freq' is unsigned, so the test doesn't catch that.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
> index f0c2b7a..734d980 100644
> --- a/drivers/watchdog/gef_wdt.c
> +++ b/drivers/watchdog/gef_wdt.c
> @@ -269,7 +269,7 @@ static int __devinit gef_wdt_probe(struct of_device *dev,
>  	bus_clk = 133; /* in MHz */
>  
>  	freq = fsl_get_sys_freq();
> -	if (freq > 0)
> +	if (freq != -1)
>  		bus_clk = freq;
>  
>  	/* Map devices registers into memory */

patch added into the linux-2.6-watchdog-next tree.
Will sent it to linus for inclusion into main kernel tree tonight together with some other fixes.

Kind regards,
Wim.


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

end of thread, other threads:[~2009-03-05  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-03 14:10 [PATCH] watchdog: fsl_get_sys_freq() failure not noticed Roel Kluin
2009-03-05  8:47 ` Wim Van Sebroeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).