diff options
author | James Harper <james@ejbdigital.com.au> | 2014-10-30 10:08:28 +0000 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2014-10-30 14:16:39 +0000 |
commit | d4f9e806c20607cafe7bb0d9eba14ccb160390a1 (patch) | |
tree | 095a416c3a5a986f16b1535474c8792c6b2281f3 | |
parent | 37f9e258b64b3cf97c7c78df60660100c9eb5a21 (diff) | |
download | hqemu-d4f9e806c20607cafe7bb0d9eba14ccb160390a1.zip hqemu-d4f9e806c20607cafe7bb0d9eba14ccb160390a1.tar.gz |
fix off-by-one error in pci_piix3_xen_ide_unplug
Fix off-by-one error when unplugging disks, which would otherwise leave the last ATA disk plugged, with obvious consequences. Also rewrite loop to be more readable.
Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
-rw-r--r-- | hw/ide/piix.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 574b9c1..b0172fb 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -171,11 +171,11 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev) { PCIIDEState *pci_ide; DriveInfo *di; - int i = 0; + int i; pci_ide = PCI_IDE(dev); - for (; i < 3; i++) { + for (i = 0; i < 4; i++) { di = drive_get_by_index(IF_IDE, i); if (di != NULL && !di->media_cd) { BlockBackend *blk = blk_by_legacy_dinfo(di); |