Module Name:    src
Committed By:   scw
Date:           Fri Aug 24 15:25:11 UTC 2012

Modified Files:
        src/sys/arch/arm/omap: omap_wdt.c

Log Message:
Defend against the case where omapwdt32k_enable() can be called via ddb if
the kernel crashes early on before the watchdog driver starts.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap_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/omap/omap_wdt.c
diff -u src/sys/arch/arm/omap/omap_wdt.c:1.3 src/sys/arch/arm/omap/omap_wdt.c:1.4
--- src/sys/arch/arm/omap/omap_wdt.c:1.3	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/omap_wdt.c	Fri Aug 24 15:25:11 2012
@@ -148,7 +148,13 @@ int
 omapwdt32k_enable(int enable)
 {
 	int s;
-	int prev_state = omapwdt32k_sc->sc_armed;
+	int prev_state;
+
+	/* Just return if ddb is entered before the watchdog driver starts. */
+	if (omapwdt32k_sc == NULL)
+		return (0);
+
+	prev_state = omapwdt32k_sc->sc_armed;
 
 	/* Normalize the int to a boolean so we can compare values directly.
 	 */

Reply via email to