summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-11-23 18:21:44 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-11-23 18:21:44 +0000
commit5a9127f088e3735e2e9bfd36e35fef9ad9fef596 (patch)
treee948d4bc37acf0750ad65b57ab61138425f1aad0 /sys
parent6f1d357bdb9439aa35b24ebe7fb90ebf0330dece (diff)
Since the devices that we detach may have children we cannot rely on the
"previous" device still being there, so if we detach a device, we really have to start from scratch again (like the comment on this code actually says we should). Simplifies the code as a bonus. ok dlg@, deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_autoconf.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index d5ad29586e6..83ebf9a7990 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.54 2007/10/29 01:05:13 dlg Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.55 2007/11/23 18:21:43 kettenis Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -713,7 +713,7 @@ config_pending_decr(void)
int
config_detach_children(struct device *parent, int flags)
{
- struct device *dev, *next_dev, *prev_dev;
+ struct device *dev, *next_dev;
int rv = 0;
/*
@@ -728,15 +728,13 @@ config_detach_children(struct device *parent, int flags)
* we are about to detach, so it would disappear.
* Just play it safe and restart from the parent.
*/
- for (prev_dev = NULL, dev = TAILQ_LAST(&alldevs, devicelist);
+ for (dev = TAILQ_LAST(&alldevs, devicelist);
dev != NULL; dev = next_dev) {
if (dev->dv_parent == parent) {
if ((rv = config_detach(dev, flags)) != 0)
return (rv);
- next_dev = prev_dev ? prev_dev : TAILQ_LAST(&alldevs,
- devicelist);
+ next_dev = TAILQ_LAST(&alldevs, devicelist);
} else {
- prev_dev = dev;
next_dev = TAILQ_PREV(dev, devicelist, dv_list);
}
}