Appropriate NULL pointer checking to avoid mysterious panic during

device cloning.

Approved by:	netchild (mentor)
This commit is contained in:
Ariff Abdullah 2005-11-03 08:19:04 +00:00
parent fe35a11a2b
commit 8be20fbe2a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152005
2 changed files with 2 additions and 2 deletions

View File

@ -1157,7 +1157,7 @@ dsp_clone(void *arg, struct ucred *cred, char *name, int namelen,
panic("Unknown devtype %d", devtype);
}
if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
if ((pdev != NULL) && (pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
*dev = pdev;
dev_ref(*dev);
return;

View File

@ -515,7 +515,7 @@ mixer_clone(void *arg, struct ucred *cred, char *name, int namelen,
return;
if (strcmp(name, "mixer") == 0) {
sd = devclass_get_softc(pcm_devclass, snd_unit);
if (sd != NULL) {
if (sd != NULL && sd->mixer_dev != NULL) {
*dev = sd->mixer_dev;
dev_ref(*dev);
}