git: 4e3ad581b5dc - stable/14 - bus_generic_detach: Remove redundant check

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sun, 01 Dec 2024 04:56:56 UTC
The branch stable/14 has been updated by jhb:

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

commit 4e3ad581b5dc350dfc7b0d311c06fa2a489a3d20
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-10-16 18:08:49 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-12-01 02:46:04 +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
    
    (cherry picked from commit 3342afcbaf42c2e6a4604c84e267901411e790ca)
---
 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 d271013b4b1f..d22dd4868ff6 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3465,9 +3465,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.