git: faf0bf43df0c - main - cgem: Cleanup detaching of child miibus device

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 02 Jan 2025 18:28:24 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=faf0bf43df0c2a16cbffc1e8f88f105a259c7e77

commit faf0bf43df0c2a16cbffc1e8f88f105a259c7e77
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-02 18:23:16 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-01-02 18:23:16 +0000

    cgem: Cleanup detaching of child miibus device
    
    Move bus_generic_detach earlier in place of the existing
    device_delete_child.
    
    Differential Revision:  https://reviews.freebsd.org/D47964
---
 sys/dev/cadence/if_cgem.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c
index 67fbdf4e3fc5..4a7180fd15a4 100644
--- a/sys/dev/cadence/if_cgem.c
+++ b/sys/dev/cadence/if_cgem.c
@@ -1909,10 +1909,7 @@ cgem_detach(device_t dev)
 		ether_ifdetach(sc->ifp);
 	}
 
-	if (sc->miibus != NULL) {
-		device_delete_child(dev, sc->miibus);
-		sc->miibus = NULL;
-	}
+	bus_generic_detach(dev);
 
 	/* Release resources. */
 	if (sc->mem_res != NULL) {
@@ -1965,8 +1962,6 @@ cgem_detach(device_t dev)
 		sc->mbuf_dma_tag = NULL;
 	}
 
-	bus_generic_detach(dev);
-
 	if (sc->clk_tsuclk)
 		clk_release(sc->clk_tsuclk);
 	if (sc->clk_rxclk)