Date: Thu, 5 Jul 2018 15:34:16 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335985 - head/sys/arm/freescale/vybrid Message-ID: <201807051534.w65FYGvl012964@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Thu Jul 5 15:34:16 2018 New Revision: 335985 URL: https://svnweb.freebsd.org/changeset/base/335985 Log: Remove a test and early-out which just can't possibly be right. It causes detach() to do nothing if attach() succeeded, which is the opposite of what's needed. Also, move device_delete_children() from the end to the beginning of detach(), so that children won't be trying to make use of the hardware we're in the process of shutting down. PR: 229510 Modified: head/sys/arm/freescale/vybrid/vf_ehci.c Modified: head/sys/arm/freescale/vybrid/vf_ehci.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_ehci.c Thu Jul 5 15:27:38 2018 (r335984) +++ head/sys/arm/freescale/vybrid/vf_ehci.c Thu Jul 5 15:34:16 2018 (r335985) @@ -390,8 +390,9 @@ vybrid_ehci_detach(device_t dev) esc = device_get_softc(dev); sc = &esc->base; - if (sc->sc_flags & EHCI_SCFLG_DONEINIT) - return (0); + /* First detach all children; we can't detach if that fails. */ + if ((err = device_delete_children(dev)) != 0) + return (err); /* * only call ehci_detach() after ehci_init() @@ -419,14 +420,6 @@ vybrid_ehci_detach(device_t dev) } sc->sc_intr_hdl = NULL; } - - if (sc->sc_bus.bdev) { - device_delete_child(dev, sc->sc_bus.bdev); - sc->sc_bus.bdev = NULL; - } - - /* During module unload there are lots of children leftover */ - device_delete_children(dev); bus_release_resources(dev, vybrid_ehci_spec, esc->res);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807051534.w65FYGvl012964>