git: 24d5a8e6eec2 - main - dpaa2_mc: Check for error the first time bus_generic_detach is called

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 05 Nov 2024 01:33:44 UTC
The branch main has been updated by jhb:

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

commit 24d5a8e6eec2b9eed9591971f223d79b8d7044c9
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-11-05 01:30:53 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-05 01:30:53 +0000

    dpaa2_mc: Check for error the first time bus_generic_detach is called
    
    This removes the need for the second call.
    
    Reviewed by:    dsl
    Differential Revision:  https://reviews.freebsd.org/D47388
---
 sys/dev/dpaa2/dpaa2_mc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/dev/dpaa2/dpaa2_mc.c b/sys/dev/dpaa2/dpaa2_mc.c
index da8f8a077d6b..c7553e8a514a 100644
--- a/sys/dev/dpaa2/dpaa2_mc.c
+++ b/sys/dev/dpaa2/dpaa2_mc.c
@@ -281,7 +281,9 @@ dpaa2_mc_detach(device_t dev)
 	struct dpaa2_devinfo *dinfo = NULL;
 	int error;
 
-	bus_generic_detach(dev);
+	error = bus_generic_detach(dev);
+	if (error != 0)
+		return (error);
 
 	sc = device_get_softc(dev);
 	if (sc->rcdev)
@@ -292,10 +294,6 @@ dpaa2_mc_detach(device_t dev)
 	if (dinfo)
 		free(dinfo, M_DPAA2_MC);
 
-	error = bus_generic_detach(dev);
-	if (error != 0)
-		return (error);
-
 	return (device_delete_children(dev));
 }