Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/omap Defend against the case where omapwdt32k_e...



details:   https://anonhg.NetBSD.org/src/rev/ccb3b7c95e84
branches:  trunk
changeset: 781177:ccb3b7c95e84
user:      scw <scw%NetBSD.org@localhost>
date:      Fri Aug 24 15:25:11 2012 +0000

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

diffstat:

 sys/arch/arm/omap/omap_wdt.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r e74024afc469 -r ccb3b7c95e84 sys/arch/arm/omap/omap_wdt.c
--- a/sys/arch/arm/omap/omap_wdt.c      Fri Aug 24 13:14:19 2012 +0000
+++ b/sys/arch/arm/omap/omap_wdt.c      Fri Aug 24 15:25:11 2012 +0000
@@ -148,7 +148,13 @@
 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.
         */



Home | Main Index | Thread Index | Old Index