Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev/pci Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/71ab0e00bcef
branches:  netbsd-7
changeset: 798305:71ab0e00bcef
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Aug 29 11:37:51 2014 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #61):
        sys/dev/pci/if_wm.c: revision 1.290
        sys/dev/pci/if_wmvar.h: revision 1.20
Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and check
the flag in wm_detach(). It will avoid to panic in wm_detach().
Fixes PR#49102.

diffstat:

 sys/dev/pci/if_wm.c    |  22 ++++++++++++++--------
 sys/dev/pci/if_wmvar.h |   3 ++-
 2 files changed, 16 insertions(+), 9 deletions(-)

diffs (102 lines):

diff -r 0e7f7c567f8a -r 71ab0e00bcef sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Aug 29 11:35:28 2014 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Aug 29 11:37:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.289 2014/08/10 16:44:36 tls Exp $  */
+/*     $NetBSD: if_wm.c,v 1.289.2.1 2014/08/29 11:37:51 martin Exp $   */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.1 2014/08/29 11:37:51 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1718,7 +1718,7 @@
                    &sc->sc_flasht, &sc->sc_flashh, NULL, NULL)) {
                        aprint_error_dev(sc->sc_dev,
                            "can't map FLASH registers\n");
-                       return;
+                       goto fail_5;
                }
                reg = ICH8_FLASH_READ32(sc, ICH_FLASH_GFPREG);
                sc->sc_ich8_flash_base = (reg & ICH_GFPREG_BASE_MASK) *
@@ -1838,7 +1838,7 @@
                if (wm_read_mac_addr(sc, enaddr) != 0) {
                        aprint_error_dev(sc->sc_dev,
                            "unable to read Ethernet address\n");
-                       return;
+                       goto fail_5;
                }
        }
 
@@ -1856,7 +1856,7 @@
        } else {
                if (wm_nvm_read(sc, EEPROM_OFF_CFG1, 1, &cfg1)) {
                        aprint_error_dev(sc->sc_dev, "unable to read CFG1\n");
-                       return;
+                       goto fail_5;
                }
        }
 
@@ -1867,7 +1867,7 @@
        } else {
                if (wm_nvm_read(sc, EEPROM_OFF_CFG2, 1, &cfg2)) {
                        aprint_error_dev(sc->sc_dev, "unable to read CFG2\n");
-                       return;
+                       goto fail_5;
                }
        }
 
@@ -1937,7 +1937,7 @@
                        if (wm_nvm_read(sc, EEPROM_OFF_SWDPIN, 1, &swdpin)) {
                                aprint_error_dev(sc->sc_dev,
                                    "unable to read SWDPIN\n");
-                               return;
+                               goto fail_5;
                        }
                }
        }
@@ -2253,6 +2253,7 @@
        else
                aprint_error_dev(self, "couldn't establish power handler\n");
 
+       sc->sc_flags |= WM_F_ATTACHED;
        return;
 
        /*
@@ -2292,7 +2293,12 @@
        int i;
 #ifndef WM_MPSAFE
        int s;
-
+#endif
+
+       if ((sc->sc_flags & WM_F_ATTACHED) == 0)
+               return 0;
+
+#ifndef WM_MPSAFE
        s = splnet();
 #endif
        /* Stop the interface. Callouts are stopped in it. */
diff -r 0e7f7c567f8a -r 71ab0e00bcef sys/dev/pci/if_wmvar.h
--- a/sys/dev/pci/if_wmvar.h    Fri Aug 29 11:35:28 2014 +0000
+++ b/sys/dev/pci/if_wmvar.h    Fri Aug 29 11:37:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wmvar.h,v 1.19 2014/07/14 05:00:18 msaitoh Exp $    */
+/*     $NetBSD: if_wmvar.h,v 1.19.2.1 2014/08/29 11:37:51 martin Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -95,6 +95,7 @@
 #define WM_F_HAS_MANAGE                0x00100000
 #define WM_F_WOL               0x00200000
 #define WM_F_EEE               0x00400000 /* Energy Efficiency Ethernet */
+#define WM_F_ATTACHED          0x00800000 /* attach() fininsed successfully */
 
 typedef enum {
        WM_T_unknown            = 0,



Home | Main Index | Thread Index | Old Index