Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Set the WM_F_ATTACHED flag if wm_attach() finish...
details: https://anonhg.NetBSD.org/src/rev/757903de3146
branches: trunk
changeset: 331807:757903de3146
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Sun Aug 24 21:15:35 2014 +0000
description:
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 029d36ea9ef6 -r 757903de3146 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Sun Aug 24 20:37:35 2014 +0000
+++ b/sys/dev/pci/if_wm.c Sun Aug 24 21:15:35 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.290 2014/08/24 21:15:35 msaitoh 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.290 2014/08/24 21:15:35 msaitoh 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 029d36ea9ef6 -r 757903de3146 sys/dev/pci/if_wmvar.h
--- a/sys/dev/pci/if_wmvar.h Sun Aug 24 20:37:35 2014 +0000
+++ b/sys/dev/pci/if_wmvar.h Sun Aug 24 21:15:35 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.20 2014/08/24 21:15:35 msaitoh 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