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:
parent
9b23cfb76b
commit
178e785fb4
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user