aboutsummaryrefslogtreecommitdiff
path: root/hw/pci-hotplug.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-04-10 08:17:36 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-04-10 08:17:36 -0500
commit6da25bd5e8355230b9562417e386728c31783002 (patch)
tree5ecc4214c74891c7e417ecfe184c721f76bdf95e /hw/pci-hotplug.c
parentbb5d8dd757eaa8f9a048c5205c69bed20ea373d1 (diff)
parenta15fef21c746e3aa0a94cf7b5bd9799886236666 (diff)
Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: qapi: convert device_del qdev: qdev_unplug(): use error_set()
Diffstat (limited to 'hw/pci-hotplug.c')
-rw-r--r--hw/pci-hotplug.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index 5c6307fa5d..c55d8b9396 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -32,6 +32,7 @@
#include "virtio-blk.h"
#include "qemu-config.h"
#include "blockdev.h"
+#include "error.h"
#if defined(TARGET_I386)
static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
@@ -191,7 +192,7 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
dev = NULL;
if (dev && dinfo) {
if (scsi_hot_add(mon, &dev->qdev, dinfo, 0) != 0) {
- qdev_unplug(&dev->qdev);
+ qdev_unplug(&dev->qdev, NULL);
dev = NULL;
}
}
@@ -258,6 +259,7 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
PCIDevice *d;
int dom, bus;
unsigned slot;
+ Error *local_err = NULL;
if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) {
return -1;
@@ -268,7 +270,15 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
monitor_printf(mon, "slot %d empty\n", slot);
return -1;
}
- return qdev_unplug(&d->qdev);
+
+ qdev_unplug(&d->qdev, &local_err);
+ if (error_is_set(&local_err)) {
+ monitor_printf(mon, "%s\n", error_get_pretty(local_err));
+ error_free(local_err);
+ return -1;
+ }
+
+ return 0;
}
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict)