aboutsummaryrefslogtreecommitdiff
path: root/hw/pci
diff options
context:
space:
mode:
Diffstat (limited to 'hw/pci')
-rw-r--r--hw/pci/pci.c18
-rw-r--r--hw/pci/shpc.c2
2 files changed, 15 insertions, 5 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index cc5d946b8f..6941a82a7f 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1613,9 +1613,11 @@ static const char * const pci_nic_names[] = {
/* Initialize a PCI NIC. */
static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
const char *default_model,
- const char *default_devaddr)
+ const char *default_devaddr,
+ Error **errp)
{
const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
+ Error *err = NULL;
PCIBus *bus;
int devfn;
PCIDevice *pci_dev;
@@ -1636,8 +1638,13 @@ static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
pci_dev = pci_create(bus, devfn, pci_nic_names[i]);
dev = &pci_dev->qdev;
qdev_set_nic_properties(dev, nd);
- if (qdev_init(dev) < 0)
+
+ object_property_set_bool(OBJECT(dev), true, "realized", &err);
+ if (err) {
+ error_propagate(errp, err);
+ object_unparent(OBJECT(dev));
return NULL;
+ }
return pci_dev;
}
@@ -1645,14 +1652,17 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
const char *default_model,
const char *default_devaddr)
{
+ Error *err = NULL;
PCIDevice *res;
if (qemu_show_nic_models(nd->model, pci_nic_models))
exit(0);
- res = pci_nic_init(nd, rootbus, default_model, default_devaddr);
- if (!res)
+ res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err);
+ if (!res) {
+ error_report_err(err);
exit(1);
+ }
return res;
}
diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index 5fd7f4bbb7..759910f79a 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -159,7 +159,7 @@ static void shpc_interrupt_update(PCIDevice *d)
for (slot = 0; slot < shpc->nslots; ++slot) {
uint8_t event = shpc->config[SHPC_SLOT_EVENT_LATCH(slot)];
uint8_t disable = shpc->config[SHPC_SLOT_EVENT_SERR_INT_DIS(d, slot)];
- uint32_t mask = 1 << SHPC_IDX_TO_LOGICAL(slot);
+ uint32_t mask = 1U << SHPC_IDX_TO_LOGICAL(slot);
if (event & ~disable) {
int_locator |= mask;
}