Skip to contentSkip to conversation

watchdog: fsl_get_sys_freq() failure not noticed

PATCH In review Roel Kluin 2 participants 2 messages Mar 3, 2009 – Mar 5, 2009 Watchdog device drivers

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 watchdog: fsl_get_sys_freq() failure not noticed

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.

---

drivers/watchdog/gef_wdt.c +1 -1
index f0c2b7a..734d980 100644
@@ -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 */
#1 lore raw

Hi Roel,

Quoted 16 lines

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.

---

drivers/watchdog/gef_wdt.c +0 -0
index f0c2b7a..734d980 100644

drivers/watchdog/gef_wdt.c static int __devinit gef_wdt_probe(struct of_device *dev, · line 275

Quoted 8 lines
drivers/watchdog/gef_wdt.c +1 -1
@@ -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.