summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel.a@redhat.com>2014-10-27 19:34:41 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-11-02 13:44:12 +0200
commit178e785fb4507ec3462dc772bbe08303416ece47 (patch)
treecaa1085c2bf22ef277b66edc4cf7065cc382b4de /hw
parent9b23cfb76b3a5e9eb5cc899eaf2f46bc46d33ba4 (diff)
downloadhqemu-178e785fb4507ec3462dc772bbe08303416ece47.zip
hqemu-178e785fb4507ec3462dc772bbe08303416ece47.tar.gz
hw/pci: fixed error flow in pci_qdev_init
Verify return code for pci_add_option_rom. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/pci/pci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 6ce75aa..36226eb 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1776,7 +1776,12 @@ static int pci_qdev_init(DeviceState *qdev)
pci_dev->romfile = g_strdup(pc->romfile);
is_default_rom = true;
}
- pci_add_option_rom(pci_dev, is_default_rom);
+
+ rc = pci_add_option_rom(pci_dev, is_default_rom);
+ if (rc != 0) {
+ pci_unregister_device(DEVICE(pci_dev));
+ return rc;
+ }
return 0;
}
OpenPOWER on IntegriCloud