Module Name:    src
Committed By:   dyoung
Date:           Mon Aug 15 17:01:28 UTC 2011

Modified Files:
        src/sys/dev/pcmcia: if_wi_pcmcia.c

Log Message:
Only try to disestablish the interrupt handler if the handler was
previously established.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pcmcia/if_wi_pcmcia.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/dev/pcmcia/if_wi_pcmcia.c
diff -u src/sys/dev/pcmcia/if_wi_pcmcia.c:1.86 src/sys/dev/pcmcia/if_wi_pcmcia.c:1.87
--- src/sys/dev/pcmcia/if_wi_pcmcia.c:1.86	Tue Nov 23 04:33:10 2010
+++ src/sys/dev/pcmcia/if_wi_pcmcia.c	Mon Aug 15 17:01:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wi_pcmcia.c,v 1.86 2010/11/23 04:33:10 christos Exp $ */
+/* $NetBSD: if_wi_pcmcia.c,v 1.87 2011/08/15 17:01:28 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.86 2010/11/23 04:33:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.87 2011/08/15 17:01:28 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -300,8 +300,10 @@
 		DELAY(1000);
 	} else {
 		pcmcia_function_disable(psc->sc_pf);
-		pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
-		sc->sc_ih = 0;
+		if (sc->sc_ih != NULL) {
+			pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
+			sc->sc_ih = NULL;
+		}
 	}
 
 	return 0;
@@ -391,6 +393,7 @@
 wi_pcmcia_detach(device_t self, int flags)
 {
 	struct wi_pcmcia_softc *psc = device_private(self);
+	struct wi_softc *sc = &psc->sc_wi;
 	int error;
 
 	if (psc->sc_state != WI_PCMCIA_ATTACHED)
@@ -400,6 +403,9 @@
 	if (error != 0)
 		return (error);
 
+	if (sc->sc_ih != NULL)
+		pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
+
 	pcmcia_function_unconfigure(psc->sc_pf);
 
 	return (0);

Reply via email to