提交 d4f9e806 编写于 作者: J James Harper 提交者: Stefano Stabellini

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: NJames Harper <james.harper@ejbdigital.com.au>
Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
上级 37f9e258
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册