Account for alias devices when tearing them down in destroy_dev() so we

don't panic on a NULL cdev->si_devsw.
This commit is contained in:
Brian Feldman 2004-09-29 16:38:38 +00:00
parent 983b3659b8
commit 1abf2c3678

View File

@ -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;