diff options
author | green <green@FreeBSD.org> | 2004-09-29 16:38:38 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-09-29 16:38:38 +0000 |
commit | 70acfe3e4fa84e9ca2006217be0f76dc062c29ee (patch) | |
tree | 28e5e9d5bda40534550ebd8b7c8e9b6917b6ad54 /sys | |
parent | 99be37dba4631a9690194b435aff16bfc934ad27 (diff) | |
download | FreeBSD-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.c | 6 |
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; |