Skip to content

Commit

Permalink
hw/pci: fixed error flow in pci_qdev_init
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Apfelbaum authored and mstsirkin committed Nov 2, 2014
1 parent 9b23cfb commit 178e785
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hw/pci/pci.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 178e785

Please sign in to comment.