Module Name:    src
Committed By:   martin
Date:           Sun Aug 12 18:51:09 UTC 2012

Modified Files:
        src/sys/dev/pci [netbsd-6]: if_ath_pci.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #476):
        sys/dev/pci/if_ath_pci.c: revision 1.46
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.45.8.1 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.45.8.1
--- 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	Sun Aug 12 18:51:09 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.45.8.1 2012/08/12 18:51:09 martin 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.45.8.1 2012/08/12 18:51:09 martin 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