git: c7ec1fadb52d - stable/14 - device_attach: Invoke BUS_CHILD_DETACHED if an attach routine fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Dec 2024 04:56:55 UTC
The branch stable/14 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=c7ec1fadb52d05c998c8e304ed8085946d971389
commit c7ec1fadb52d05c998c8e304ed8085946d971389
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-10-16 18:08:35 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-12-01 02:46:04 +0000
device_attach: Invoke BUS_CHILD_DETACHED if an attach routine fails
This gives the parent bus driver the opportunity to cleanup any
allocated resources, etc. left behind by a failed attach attempt.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47155
(cherry picked from commit 42078dfb0f72edbf83217cc8c997c0a54d951990)
---
sys/kern/subr_bus.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 982eeaebf21c..d271013b4b1f 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -2597,6 +2597,7 @@ device_attach(device_t dev)
if ((error = DEVICE_ATTACH(dev)) != 0) {
printf("device_attach: %s%d attach returned %d\n",
dev->driver->name, dev->unit, error);
+ BUS_CHILD_DETACHED(dev->parent, dev);
if (disable_failed_devs) {
/*
* When the user has asked to disable failed devices, we