aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/e1000.c3
-rw-r--r--hw/eepro100.c3
-rw-r--r--hw/ne2000.c3
-rw-r--r--hw/pcnet.c4
-rw-r--r--hw/rtl8139.c4
5 files changed, 17 insertions, 0 deletions
diff --git a/hw/e1000.c b/hw/e1000.c
index 1729db28e1..b0fe917342 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1063,6 +1063,9 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn)
d = (E1000State *)pci_register_device(bus, "e1000",
sizeof(E1000State), devfn, NULL, NULL);
+ if (!d)
+ return NULL;
+
pci_conf = d->dev.config;
memset(pci_conf, 0, 256);
diff --git a/hw/eepro100.c b/hw/eepro100.c
index caf687a835..8eb94fd469 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1764,6 +1764,9 @@ static PCIDevice *nic_init(PCIBus * bus, NICInfo * nd, uint32_t device)
d = (PCIEEPRO100State *) pci_register_device(bus, nd->model,
sizeof(PCIEEPRO100State), -1,
NULL, NULL);
+ if (!d)
+ return NULL;
+
d->dev.unregister = pci_nic_uninit;
s = &d->eepro100;
diff --git a/hw/ne2000.c b/hw/ne2000.c
index 3f308d4fcd..975951755d 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -810,6 +810,9 @@ PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
"NE2000", sizeof(PCINE2000State),
devfn,
NULL, NULL);
+ if (!d)
+ return NULL;
+
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_RTL8029);
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 6afa309f97..f3cbd58fb9 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -2023,7 +2023,11 @@ PCIDevice *pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn)
d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState),
devfn, NULL, NULL);
+ if (!d)
+ return NULL;
+
d->dev.unregister = pci_pcnet_uninit;
+
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_AMD);
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index 0093ff4a93..19c7623c58 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3451,7 +3451,11 @@ PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn)
"RTL8139", sizeof(PCIRTL8139State),
devfn,
NULL, NULL);
+ if (!d)
+ return NULL;
+
d->dev.unregister = pci_rtl8139_uninit;
+
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139);