git: 3342afcbaf42 - main - bus_generic_detach: Remove redundant check

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 16 Oct 2024 18:09:18 UTC
The branch main has been updated by jhb:

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

commit 3342afcbaf42c2e6a4604c84e267901411e790ca
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-10-16 18:08:49 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-10-16 18:08:49 +0000

    bus_generic_detach: Remove redundant check
    
    device_detach() checks the device state and only calls a driver's
    DEVICE_DETACH method if the device is attached but not busy.
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D47156
---
 sys/kern/subr_bus.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 7140ca007b71..7c21325f8684 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3405,9 +3405,6 @@ bus_generic_detach(device_t dev)
 	device_t child;
 	int error;
 
-	if (dev->state != DS_ATTACHED)
-		return (EBUSY);
-
 	/*
 	 * Detach children in the reverse order.
 	 * See bus_generic_suspend for details.