summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-01-26 10:27:12 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-01-26 10:27:12 +0000
commit64cda4e365ddb1be065912f0591b572d1af8aa08 (patch)
tree5675e9e42d1d17bdf10da353182b8da278d9948b
parenteb4463295ba6da7a5b6c1d94f38f7d52ef926c06 (diff)
downloadFreeBSD-src-64cda4e365ddb1be065912f0591b572d1af8aa08.zip
FreeBSD-src-64cda4e365ddb1be065912f0591b572d1af8aa08.tar.gz
Don't set ivars until we checked the return value from device_add_child.
-rw-r--r--sys/dev/usb/ohci_pci.c2
-rw-r--r--sys/dev/usb/uhci_pci.c2
-rw-r--r--sys/pci/ohci_pci.c2
-rw-r--r--sys/pci/uhci_pci.c2
4 files changed, 4 insertions, 4 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:
diff --git a/sys/pci/ohci_pci.c b/sys/pci/ohci_pci.c
index 1f5f345..27fe020 100644
--- a/sys/pci/ohci_pci.c
+++ b/sys/pci/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/pci/uhci_pci.c b/sys/pci/uhci_pci.c
index 779eb56..d342c81 100644
--- a/sys/pci/uhci_pci.c
+++ b/sys/pci/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:
OpenPOWER on IntegriCloud