git: 42078dfb0f72 - main - device_attach: Invoke BUS_CHILD_DETACHED if an attach routine fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Oct 2024 18:09:17 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=42078dfb0f72edbf83217cc8c997c0a54d951990
commit 42078dfb0f72edbf83217cc8c997c0a54d951990
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-10-16 18:08:35 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-10-16 18:08:35 +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
---
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 f41884d576a8..7140ca007b71 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -2544,6 +2544,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