Handle the error case properly for device_get_children.
This commit is contained in:
parent
099ea4b570
commit
25ee8cca07
@ -699,8 +699,8 @@ USB_DETACH(uaudio)
|
||||
|
||||
err = bus_generic_detach(sc->sc_dev);
|
||||
|
||||
if (err == 0) {
|
||||
device_get_children(sc->sc_dev, &devlist, &devcount);
|
||||
if (err == 0 &&
|
||||
device_get_children(sc->sc_dev, &devlist, &devcount) == 0) {
|
||||
for (i = 0; devlist != NULL && i < devcount; i++) {
|
||||
func = device_get_ivars(devlist[i]);
|
||||
if (func != NULL && func->func == SCF_PCM &&
|
||||
@ -710,8 +710,7 @@ USB_DETACH(uaudio)
|
||||
device_delete_child(sc->sc_dev, devlist[i]);
|
||||
}
|
||||
}
|
||||
if (devlist != NULL)
|
||||
free(devlist, M_TEMP);
|
||||
free(devlist, M_TEMP);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user