Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia make sure that we don't die if attach fails a...



details:   https://anonhg.NetBSD.org/src/rev/0efadcbe955e
branches:  trunk
changeset: 524961:0efadcbe955e
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 03 00:18:31 2002 +0000

description:
make sure that we don't die if attach fails and we pull the card.

diffstat:

 sys/dev/pcmcia/com_pcmcia.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 4c0675d15522 -r 0efadcbe955e sys/dev/pcmcia/com_pcmcia.c
--- a/sys/dev/pcmcia/com_pcmcia.c       Wed Apr 03 00:12:41 2002 +0000
+++ b/sys/dev/pcmcia/com_pcmcia.c       Wed Apr 03 00:18:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_pcmcia.c,v 1.26 2002/03/10 19:20:50 cyber Exp $     */
+/*     $NetBSD: com_pcmcia.c,v 1.27 2002/04/03 00:18:31 christos Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.26 2002/03/10 19:20:50 cyber Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.27 2002/04/03 00:18:31 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -217,6 +217,8 @@
 
        psc->sc_pf = pa->pf;
 
+       psc->sc_io_window = -1;
+
 retry:
        /* find a cfe we can use */
 
@@ -308,11 +310,13 @@
        struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) self;
        int error;
 
-       if ((error = com_detach(self, flags)) != 0)
-               return error;
+       if (psc->sc_io_window != -1) {
+               if ((error = com_detach(self, flags)) != 0)
+                       return error;
 
-       /* Unmap our i/o window. */
-       pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window);
+               /* Unmap our i/o window. */
+               pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window);
+       }
 
        /* Free our i/o space. */
        pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh);



Home | Main Index | Thread Index | Old Index