virtio: Fix error handling in virtio_bus_device_plugged
commita77690c41da67d85bab1e784a9f24f18bc63dbd9
authorFam Zheng <famz@redhat.com>
Fri, 17 Mar 2017 12:32:42 +0000 (17 20:32 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 22 Mar 2017 15:54:32 +0000 (22 17:54 +0200)
tree5a69239afea638831aa8d7dd056e4658fa93ce8a
parent55a19ad8b2d0797e3a8fe90ab99a9bb713824059
virtio: Fix error handling in virtio_bus_device_plugged

For one thing we shouldn't continue if an error happened, for the other
two steps failing can cause an abort() in error_setg because we reuse
the same errp blindly.

Add error handling checks to fix both issues.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/virtio/virtio-bus.c