Appropriate NULL pointer checking to avoid mysterious panic during

device cloning.

Approved by:	netchild (mentor)
This commit is contained in:
ariff 2005-11-03 08:19:04 +00:00
parent adb08ca53a
commit 94d7cede20
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);
}