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>
This commit is contained in:
Marcel Apfelbaum 2014-10-27 19:34:41 +02:00 committed by Michael S. Tsirkin
parent 9b23cfb76b
commit 178e785fb4

View File

@ -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;
}