Skip to contentSkip to conversation

S3C24XX: Fix watchdog driver way-out path

PATCH New Ben Dooks 1 participant 1 message Sep 6, 2006

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 S3C24XX: Fix watchdog driver way-out path

If the driver is not configured for no way out, then the open method should not automatically allow the setting of allow_close to CLOSE_STATE_ALLOW.

The setting of allow_close nullifies the use of the magic close via the write path. It means that in the default state, the watchdog will shut-down even if the magic close has not been issued.

drivers/char/watchdog/s3c2410_wdt.c +5 -5
diff -urpN -X ../dontdiff linux-2.6.18-rc5-s3c2412-r5/drivers/char/watchdog/s3c2410_wdt.c linux-2.6.18-rc5-s3c2412-r6/drivers/char/watchdog/s3c2410_wdt.c
@@ -62,7 +62,7 @@
 #define CONFIG_S3C2410_WATCHDOG_ATBOOT		(0)
 #define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME	(15)
 
-static int nowayout = WATCHDOG_NOWAYOUT;
+static int nowayout	= WATCHDOG_NOWAYOUT;
 static int tmr_margin	= CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME;
 static int tmr_atboot	= CONFIG_S3C2410_WATCHDOG_ATBOOT;
 static int soft_noboot	= 0;
@@ -213,11 +213,10 @@ static int s3c2410wdt_open(struct inode 
 	if(down_trylock(&open_lock))
 		return -EBUSY;
 
-	if (nowayout) {
+	if (nowayout)
 		__module_get(THIS_MODULE);
-	} else {
-		allow_close = CLOSE_STATE_ALLOW;
-	}
+
+	allow_close = CLOSE_STATE_NOT;
 
 	/* start the timer */
 	s3c2410wdt_start();
@@ -230,6 +229,7 @@ static int s3c2410wdt_release(struct ino
 	 *	Shut off the timer.
 	 * 	Lock it in if it's a module and we set nowayout
 	 */
+
 	if (allow_close == CLOSE_STATE_ALLOW) {
 		s3c2410wdt_stop();
 	} else {