Don't set ivars until we checked the return value from device_add_child.

This commit is contained in:
Nick Hibma 2000-01-26 10:27:12 +00:00
parent 469bed11ef
commit 9e2bdb4369
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56630
4 changed files with 4 additions and 4 deletions

View File

@ -174,11 +174,11 @@ ohci_pci_attach(device_t self)
}
usbus = device_add_child(self, "usb", -1);
device_set_ivars(usbus, sc);
if (!usbus) {
device_printf(self, "could not add USB device\n");
return ENOMEM;
}
device_set_ivars(usbus, sc);
switch (pci_get_devid(self)) {
case PCI_OHCI_DEVICEID_ALADDIN_V:

View File

@ -182,12 +182,12 @@ uhci_pci_attach(device_t self)
}
sc->sc_bus.bdev = device_add_child(self, "usb", -1);
device_set_ivars(sc->sc_bus.bdev, sc);
if (!sc->sc_bus.bdev) {
device_printf(self, "could not add USB device\n");
err = ENOMEM;
goto bad2;
}
device_set_ivars(sc->sc_bus.bdev, sc);
switch (pci_get_devid(self)) {
case PCI_UHCI_DEVICEID_PIIX3:

View File

@ -174,11 +174,11 @@ ohci_pci_attach(device_t self)
}
usbus = device_add_child(self, "usb", -1);
device_set_ivars(usbus, sc);
if (!usbus) {
device_printf(self, "could not add USB device\n");
return ENOMEM;
}
device_set_ivars(usbus, sc);
switch (pci_get_devid(self)) {
case PCI_OHCI_DEVICEID_ALADDIN_V:

View File

@ -182,12 +182,12 @@ uhci_pci_attach(device_t self)
}
sc->sc_bus.bdev = device_add_child(self, "usb", -1);
device_set_ivars(sc->sc_bus.bdev, sc);
if (!sc->sc_bus.bdev) {
device_printf(self, "could not add USB device\n");
err = ENOMEM;
goto bad2;
}
device_set_ivars(sc->sc_bus.bdev, sc);
switch (pci_get_devid(self)) {
case PCI_UHCI_DEVICEID_PIIX3: