Module Name:    src
Committed By:   martin
Date:           Tue Jun  9 12:46:38 UTC 2015

Modified Files:
        src/sys/arch/arm/allwinner: awin_wdt.c

Log Message:
Fix period handling


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/allwinner/awin_wdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/allwinner/awin_wdt.c
diff -u src/sys/arch/arm/allwinner/awin_wdt.c:1.7 src/sys/arch/arm/allwinner/awin_wdt.c:1.8
--- src/sys/arch/arm/allwinner/awin_wdt.c:1.7	Mon Apr 20 01:33:22 2015
+++ src/sys/arch/arm/allwinner/awin_wdt.c	Tue Jun  9 12:46:37 2015
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: awin_wdt.c,v 1.7 2015/04/20 01:33:22 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_wdt.c,v 1.8 2015/06/09 12:46:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -164,12 +164,14 @@ awin_wdt_setmode(struct sysmon_wdog *smw
 		awin_wdt_tickle(smw);
 		return 0;
 	}
-	if (smw->smw_period > mapsize) {
-		return EINVAL;
-	}
 	if (smw->smw_period == WDOG_PERIOD_DEFAULT) {
 		smw->smw_period = AWIN_WDT_PERIOD_DEFAULT;
 		sc->sc_wdog_period = AWIN_WDT_PERIOD_DEFAULT;
+	} else {
+		if (smw->smw_period > mapsize) {
+			return EINVAL;
+		}
+		sc->sc_wdog_period = smw->smw_period;
 	}
 	sc->sc_wdog_mode = AWIN_WDOG_MODE_EN | map[sc->sc_wdog_period];
 	if (awin_chip_id() == AWIN_CHIP_ID_A20 ||

Reply via email to