summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2004-09-29 16:38:38 +0000
committergreen <green@FreeBSD.org>2004-09-29 16:38:38 +0000
commit70acfe3e4fa84e9ca2006217be0f76dc062c29ee (patch)
tree28e5e9d5bda40534550ebd8b7c8e9b6917b6ad54 /sys
parent99be37dba4631a9690194b435aff16bfc934ad27 (diff)
downloadFreeBSD-src-70acfe3e4fa84e9ca2006217be0f76dc062c29ee.zip
FreeBSD-src-70acfe3e4fa84e9ca2006217be0f76dc062c29ee.tar.gz
Account for alias devices when tearing them down in destroy_dev() so we
don't panic on a NULL cdev->si_devsw.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_conf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 1846fa7..f5d6077 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -579,14 +579,14 @@ idestroy_dev(struct cdev *dev)
}
csw = dev->si_devsw;
- dev->si_devsw = NULL;
- while (csw->d_purge != NULL && dev->si_threadcount) {
+ dev->si_devsw = NULL; /* already NULL for SI_ALIAS */
+ while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) {
printf("Purging %lu threads from %s\n",
dev->si_threadcount, devtoname(dev));
csw->d_purge(dev);
msleep(csw, &devmtx, PRIBIO, "devprg", hz/10);
}
- if (csw->d_purge != NULL)
+ if (csw != NULL && csw->d_purge != NULL)
printf("All threads purged from %s\n", devtoname(dev));
dev->si_drv1 = 0;
OpenPOWER on IntegriCloud