summaryrefslogtreecommitdiff
path: root/hw/ide/piix.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ide/piix.c')
-rw-r--r--hw/ide/piix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index ec93977e53..0e87e51148 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -180,9 +180,10 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
di = drive_get_by_index(IF_IDE, i);
if (di != NULL && !di->media_cd) {
BlockBackend *blk = blk_by_legacy_dinfo(di);
- DeviceState *ds = bdrv_get_attached_dev(di->bdrv);
+ BlockDriverState *bs = blk_bs(blk);
+ DeviceState *ds = bdrv_get_attached_dev(bs);
if (ds) {
- bdrv_detach_dev(di->bdrv, ds);
+ bdrv_detach_dev(bs, ds);
}
pci_ide->bus[di->bus].ifs[di->unit].bs = NULL;
blk_unref(blk);