Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia PR/16058: Tero Kivinen: Don't attempt to free...



details:   https://anonhg.NetBSD.org/src/rev/87d9f190e1ea
branches:  trunk
changeset: 525601:87d9f190e1ea
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 13 17:06:53 2002 +0000

description:
PR/16058: Tero Kivinen: Don't attempt to free resources that we failed to
get in the attach phase.

diffstat:

 sys/dev/pcmcia/com_pcmcia.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r c2f9716c762d -r 87d9f190e1ea sys/dev/pcmcia/com_pcmcia.c
--- a/sys/dev/pcmcia/com_pcmcia.c       Sat Apr 13 17:05:16 2002 +0000
+++ b/sys/dev/pcmcia/com_pcmcia.c       Sat Apr 13 17:06:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_pcmcia.c,v 1.27 2002/04/03 00:18:31 christos Exp $  */
+/*     $NetBSD: com_pcmcia.c,v 1.28 2002/04/13 17:06:53 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.27 2002/04/03 00:18:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.28 2002/04/13 17:06:53 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -310,13 +310,18 @@
        struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) self;
        int error;
 
-       if (psc->sc_io_window != -1) {
-               if ((error = com_detach(self, flags)) != 0)
-                       return error;
+       /* Unmap our i/o window. */
+       if (psc->sc_io_window == -1) {
+               printf("%s: I/O window not allocated.",
+                   psc->sc_com.sc_dev.dv_xname);
+               return 0;
+       }
 
-               /* Unmap our i/o window. */
-               pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window);
-       }
+       if ((error = com_detach(self, flags)) != 0)
+               return error;
+
+       /* 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