git: 304744faa13b - stable/13 - 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:57:45 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=304744faa13b521ce2de5f7817895867d4d11264 commit 304744faa13b521ce2de5f7817895867d4d11264 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-10-16 18:08:35 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-11-30 21:33:07 +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 5e76bbeee2bb..1f490850579e 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3036,6 +3036,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 (!(dev->flags & DF_FIXEDCLASS)) devclass_delete_device(dev->devclass, dev); (void)device_set_driver(dev, NULL);