Only delete the miibus if it was attached first.
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Mon, 13 Jun 2005 10:20:49 +0000 (10:20 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Mon, 13 Jun 2005 10:20:49 +0000 (10:20 +0000)
Noticed-by: Sepherosa Ziehau <sepherosa@gmail.com>
sys/dev/netif/sf/if_sf.c

index 4484807..38a3e2f 100644 (file)
@@ -30,7 +30,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/pci/if_sf.c,v 1.18.2.8 2001/12/16 15:46:07 luigi Exp $
- * $DragonFly: src/sys/dev/netif/sf/if_sf.c,v 1.20 2005/06/12 17:29:49 joerg Exp $
+ * $DragonFly: src/sys/dev/netif/sf/if_sf.c,v 1.21 2005/06/13 10:20:49 joerg Exp $
  */
 
 /*
@@ -829,7 +829,8 @@ static int sf_detach(dev)
                sf_stop(sc);
        }
 
-       device_delete_child(dev, sc->sf_miibus);
+       if (sc->sf_miibus)
+               device_delete_child(dev, sc->sf_miibus);
        bus_generic_detach(dev);
 
        if (sc->sf_intrhand)