Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Fix error branches in ath pci attachment.



details:   https://anonhg.NetBSD.org/src/rev/a2e7aaa55474
branches:  trunk
changeset: 780701:a2e7aaa55474
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 04 04:05:36 2012 +0000

description:
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.)

diffstat:

 sys/dev/pci/if_ath_pci.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 8025153da526 -r a2e7aaa55474 sys/dev/pci/if_ath_pci.c
--- a/sys/dev/pci/if_ath_pci.c  Sat Aug 04 03:56:47 2012 +0000
+++ b/sys/dev/pci/if_ath_pci.c  Sat Aug 04 04:05:36 2012 +0000
@@ -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 @@
        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 @@
 
        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;
+       }
 
-       bus_space_unmap(psc->sc_iot, psc->sc_ioh, psc->sc_mapsz);
+       if (psc->sc_mapsz != 0) {
+               bus_space_unmap(psc->sc_iot, psc->sc_ioh, psc->sc_mapsz);
+               psc->sc_mapsz = 0;
+       }
+
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index