summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2020-09-15 08:33:40 +0000
committermrg <mrg@NetBSD.org>2020-09-15 08:33:40 +0000
commitac82f4eea820e10fbbc1c64d57cc2fde20036173 (patch)
treeaf3369941e06b62e02eaf6caf1ad214bbbe48b38 /sys/dev/ic
parent6412e2a73199c6279715fd63d6dae42a60a84d3e (diff)
mii_detach() must come before ifmedia_fini(), otherwise mii_detach()
will have a NULL mutex and fault. this appears to have been introduced in february, and may be a problem in other drivers converted to use ifmedia_fini(). i've only fixed the two that were faulting for me on sunblade 2000 during reboot.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/gem.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index edaf4365709..a61fa73fd01 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gem.c,v 1.131 2020/07/15 01:42:27 msaitoh Exp $ */
+/* $NetBSD: gem.c,v 1.132 2020/09/15 08:33:40 mrg Exp $ */
/*
*
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.131 2020/07/15 01:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.132 2020/09/15 08:33:40 mrg Exp $");
#include "opt_inet.h"
@@ -175,7 +175,6 @@ gem_detach(struct gem_softc *sc, int flags)
rnd_detach_source(&sc->rnd_source);
ether_ifdetach(ifp);
if_detach(ifp);
- ifmedia_fini(&sc->sc_mii.mii_media);
callout_destroy(&sc->sc_tick_ch);
callout_destroy(&sc->sc_rx_watchdog);
@@ -184,6 +183,8 @@ gem_detach(struct gem_softc *sc, int flags)
case GEM_ATT_MII:
sc->sc_att_stage = GEM_ATT_MII;
mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
+ ifmedia_fini(&sc->sc_mii.mii_media);
+
/*FALLTHROUGH*/
case GEM_ATT_7:
for (i = 0; i < GEM_NRXDESC; i++) {