From patchwork Thu Oct 30 14:22:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39836 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1733E2409F for ; Thu, 30 Oct 2014 14:26:32 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf3248110eek.11 for ; Thu, 30 Oct 2014 07:26:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=3zH7h5mfGoMdb8MPiImmqVzNGaESzwUZrUi1UrRoZH4=; b=h2sYifuU2T4hzfWKT1MbTqeY631lSGZdU9KfHBcSOg9wImpiacTK8fw+gqbTQ6ADUg t7+YJUiSi6ZK2ksg68R+QbIhSOeNqzdi/VhKtUA3/uVhpRXldU6X2eNk9yyDQFKuNhqi glCdSmD/wZ/PHpZWQUmURxoxa1rnWIKyGMHIrVqqVvdMeidohqiYCpGyWle+k8ZSuIrO 6BkbJKVuRbL5U0FTg+PQxldo1sEGcDummkeshcLbigK2SdX84sH+qxaTqr5/8nrMcQQ1 8ZlA0P98NbZnmmr9r5gwS6Cyal6r0Px8LCqQmKYzAjTaEX10a7iaPDW6vHyUFgK/1ocC ukdQ== X-Gm-Message-State: ALoCoQnhxf/F5dG8387kH305GoF8nS8OeIk1Dwx4NMlP9vzWKAVvTp7QRH/dT1NS3eFsFRf3mx7n X-Received: by 10.112.89.195 with SMTP id bq3mr578993lbb.9.1414679191297; Thu, 30 Oct 2014 07:26:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.169 with SMTP id f9ls334579lam.11.gmail; Thu, 30 Oct 2014 07:26:31 -0700 (PDT) X-Received: by 10.152.22.194 with SMTP id g2mr19295529laf.33.1414679191124; Thu, 30 Oct 2014 07:26:31 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id a4si12281160lbm.77.2014.10.30.07.26.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 07:26:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so4887250lbj.27 for ; Thu, 30 Oct 2014 07:26:31 -0700 (PDT) X-Received: by 10.112.140.5 with SMTP id rc5mr19179571lbb.32.1414679191007; Thu, 30 Oct 2014 07:26:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp51790lbz; Thu, 30 Oct 2014 07:26:30 -0700 (PDT) X-Received: by 10.221.36.73 with SMTP id sz9mr13070687vcb.17.1414679187984; Thu, 30 Oct 2014 07:26:27 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id sw14si4090842vdb.7.2014.10.30.07.26.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 30 Oct 2014 07:26:27 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XjqeO-0002ta-Vk; Thu, 30 Oct 2014 14:24:32 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XjqeO-0002s0-2A for xen-devel@lists.xensource.com; Thu, 30 Oct 2014 14:24:32 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id 58/91-02702-F1A42545; Thu, 30 Oct 2014 14:24:31 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1414679066!13467521!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19870 invoked from network); 30 Oct 2014 14:24:30 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 30 Oct 2014 14:24:30 -0000 X-IronPort-AV: E=Sophos;i="5.07,286,1413244800"; d="scan'208";a="187857759" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Thu, 30 Oct 2014 10:22:34 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XjqcP-0001tu-Bk; Thu, 30 Oct 2014 14:22:29 +0000 From: Stefano Stabellini To: Date: Thu, 30 Oct 2014 14:22:27 +0000 Message-ID: <1414678947-8607-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 Cc: peter.maydell@linaro.org, xen-devel@lists.xensource.com, James Harper , James Harper , Stefano Stabellini Subject: [Xen-devel] [PULL 2/2] fix off-by-one error in pci_piix3_xen_ide_unplug X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: James Harper 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 Signed-off-by: Stefano Stabellini --- hw/ide/piix.c | 4 ++-- 1 file 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);