summaryrefslogtreecommitdiffstats
path: root/hw/scsi/scsi-bus.c
diff options
context:
space:
mode:
authorPaolo Bonzini2013-09-17 15:09:15 +0200
committerPaolo Bonzini2014-10-31 11:29:02 +0100
commitfb7b5c0df6e3c501973ce4d57eb2b1d4344a519d (patch)
treebcd55949d2026f01e311d562065183094eff242a /hw/scsi/scsi-bus.c
parentvirtio-scsi: Fix memory leak when realize failed (diff)
downloadqemu-fb7b5c0df6e3c501973ce4d57eb2b1d4344a519d.tar.gz
qemu-fb7b5c0df6e3c501973ce4d57eb2b1d4344a519d.tar.xz
qemu-fb7b5c0df6e3c501973ce4d57eb2b1d4344a519d.zip
scsi: devirtualize unrealize of SCSI devices
All implementations are the same. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi/scsi-bus.c')
-rw-r--r--hw/scsi/scsi-bus.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 6376b88722..24f7b74ae8 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -51,14 +51,6 @@ static void scsi_device_realize(SCSIDevice *s, Error **errp)
}
}
-static void scsi_device_unrealize(SCSIDevice *s, Error **errp)
-{
- SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(s);
- if (sc->unrealize) {
- sc->unrealize(s, errp);
- }
-}
-
int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf,
void *hba_private)
{
@@ -218,7 +210,9 @@ static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
if (dev->vmsentry) {
qemu_del_vm_change_state_handler(dev->vmsentry);
}
- scsi_device_unrealize(dev, errp);
+
+ scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE));
+ blockdev_mark_auto_del(dev->conf.blk);
}
/* handle legacy '-drive if=scsi,...' cmd line args */