pci: cleanly backout of pci_qdev_init()
authorAlex Williamson <alex.williamson@redhat.com>
Tue, 11 May 2010 10:44:21 +0000 (06:44 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 11 May 2010 22:59:11 +0000 (01:59 +0300)
commit5ed8e6fae28a82a48ce1e99720513d7632a88f0c
treede0ad9b6677f69773d4c5349a59d5c26858aeb7c
parent3bd33e724fdd5690f71016243f7b12f302d77655
pci: cleanly backout of pci_qdev_init()

If the init function of a device fails, as might happen with device
assignment, we never undo the work done by do_pci_register_device().
This not only causes a bit of a memory leak, but also leaves a bogus
pointer in the bus devices array that can cause a segfault or
garbage data from 'info pci'.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci.c