PR/16058: Tero Kivinen: Don't attempt to free resources that we failed to

get in the attach phase.
This commit is contained in:
christos 2002-04-13 17:06:53 +00:00
parent db29511727
commit 45c8aefabf

View File

@ -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. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@
*/ */
#include <sys/cdefs.h> #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/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -310,14 +310,19 @@ com_pcmcia_detach(self, flags)
struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) self; struct com_pcmcia_softc *psc = (struct com_pcmcia_softc *) self;
int error; int error;
if (psc->sc_io_window != -1) { /* Unmap our i/o window. */
if ((error = com_detach(self, flags)) != 0) if (psc->sc_io_window == -1) {
return error; printf("%s: I/O window not allocated.",
psc->sc_com.sc_dev.dv_xname);
/* Unmap our i/o window. */ return 0;
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. */ /* Free our i/o space. */
pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh); pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh);