diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2000-01-26 10:27:12 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2000-01-26 10:27:12 +0000 |
commit | 64cda4e365ddb1be065912f0591b572d1af8aa08 (patch) | |
tree | 5675e9e42d1d17bdf10da353182b8da278d9948b /sys/dev | |
parent | eb4463295ba6da7a5b6c1d94f38f7d52ef926c06 (diff) | |
download | FreeBSD-src-64cda4e365ddb1be065912f0591b572d1af8aa08.zip FreeBSD-src-64cda4e365ddb1be065912f0591b572d1af8aa08.tar.gz |
Don't set ivars until we checked the return value from device_add_child.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/ohci_pci.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/uhci_pci.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/usb/ohci_pci.c b/sys/dev/usb/ohci_pci.c index 1f5f345..27fe020 100644 --- a/sys/dev/usb/ohci_pci.c +++ b/sys/dev/usb/ohci_pci.c @@ -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: diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c index 779eb56..d342c81 100644 --- a/sys/dev/usb/uhci_pci.c +++ b/sys/dev/usb/uhci_pci.c @@ -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: |