Module Name:    src
Committed By:   riastradh
Date:           Sat Aug  4 04:05:36 UTC 2012

Modified Files:
        src/sys/dev/pci: if_ath_pci.c

Log Message:
Fix error branches in ath pci attachment.

Should fix double pci_intr_disestablish if ath_attach fails.

(Still not sure why ath_attach sometimes fails here.)


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/if_ath_pci.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/pci/if_ath_pci.c
diff -u src/sys/dev/pci/if_ath_pci.c:1.45 src/sys/dev/pci/if_ath_pci.c:1.46
--- src/sys/dev/pci/if_ath_pci.c:1.45	Tue Oct 18 23:04:35 2011
+++ src/sys/dev/pci/if_ath_pci.c	Sat Aug  4 04:05:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_pci.c,v 1.45 2011/10/18 23:04:35 dyoung Exp $	*/
+/*	$NetBSD: if_ath_pci.c,v 1.46 2012/08/04 04:05:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ath_pci.c,v 1.45 2011/10/18 23:04:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ath_pci.c,v 1.46 2012/08/04 04:05:36 riastradh Exp $");
 
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.
@@ -215,8 +215,10 @@ ath_pci_attach(device_t parent, device_t
 	return;
 bad3:
 	pci_intr_disestablish(pc, psc->sc_ih);
+	psc->sc_ih = NULL;
 bad1:
 	bus_space_unmap(psc->sc_iot, psc->sc_ioh, psc->sc_mapsz);
+	psc->sc_mapsz = 0;
 bad:
 	return;
 }
@@ -232,10 +234,16 @@ ath_pci_detach(device_t self, int flags)
 
 	pmf_device_deregister(self);
 
-	if (psc->sc_ih != NULL)
+	if (psc->sc_ih != NULL) {
 		pci_intr_disestablish(psc->sc_pc, psc->sc_ih);
+		psc->sc_ih = NULL;
+	}
+
+	if (psc->sc_mapsz != 0) {
+		bus_space_unmap(psc->sc_iot, psc->sc_ioh, psc->sc_mapsz);
+		psc->sc_mapsz = 0;
+	}
 
-	bus_space_unmap(psc->sc_iot, psc->sc_ioh, psc->sc_mapsz);
 	return 0;
 }
 

Reply via email to