]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
watchdog: at91sam9_wdt: fix secs_to_ticks
authorBoris BREZILLON <b.brezillon@overkiz.com>
Sun, 3 Nov 2013 17:52:42 +0000 (18:52 +0100)
committerWim Van Sebroeck <wim@iguana.be>
Tue, 28 Jan 2014 20:34:18 +0000 (21:34 +0100)
Fix the secs_to_ticks macro in case 0 is passed as an argument.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/at91sam9_wdt.c

index 9bd089ebb70fe8c4f32550338db633d2c5a41bdf..65f469145950f8f83bc541b0f91d707e25190bf8 100644 (file)
@@ -51,7 +51,7 @@
 #define ticks_to_hz_rounddown(t)       ((((t) + 1) * HZ) >> 8)
 #define ticks_to_hz_roundup(t)         (((((t) + 1) * HZ) + 255) >> 8)
 #define ticks_to_secs(t)               (((t) + 1) >> 8)
-#define secs_to_ticks(s)               (((s) << 8) - 1)
+#define secs_to_ticks(s)               ((s) ? (((s) << 8) - 1) : 0)
 
 #define WDT_MR_RESET   0x3FFF2FFF