hw/pci-bridge: fix QEMU crash because of pcie-root-port
commitfced4d00e68e7559c73746d963265f7fd0b6abf9
authorMarcel Apfelbaum <marcel@redhat.com>
Wed, 10 Jan 2018 19:09:09 +0000 (10 21:09 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 18 Jan 2018 19:52:38 +0000 (18 21:52 +0200)
tree9c1182fdb3ee28fb6ba4ebc2a339a010ba4e5888
parent37f51384ae05bd50f83308339dbffa3e78404874
hw/pci-bridge: fix QEMU crash because of pcie-root-port

If we try to use more pcie_root_ports then available slots
and an IO hint is passed to the port, QEMU crashes because
we try to init the "IO hint" capability even if the device
is not created.
Fix it by checking for error before adding the capability,
so QEMU can fail gracefully.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci-bridge/gen_pcie_root_port.c