Received: by 2002:a17:907:d504:b0:9b2:89ee:1eb8 with SMTP id wb4csp3011503ejc; Thu, 28 Sep 2023 22:07:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHrurYAkzYunOsjK3jHqzAdfyJywu3oa9shJFm2ldkPVQ2DxhPJrWjgHTbu2cbsJYw3zGl X-Received: by 2002:ac8:5846:0:b0:418:193e:79e8 with SMTP id h6-20020ac85846000000b00418193e79e8mr2953312qth.51.1695964052034; Thu, 28 Sep 2023 22:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695964052; cv=none; d=google.com; s=arc-20160816; b=utxdUr9hNz8fhkNua4I1jbdp7E5OlqxPKY6hBsgP+qVIj6xzNX5Rf72pP10QIESA4k bjSd0elv6qH6/vuOSGMRSzmElzZ23GxJPeAp6jUVpQYCn7rT2MRhE6Z82MnPC+t6e0dS JDSXDY9PKdMxp6lVFcFhqteo7v0ZMdGlDrZ97Sbt7dbsaU6eSpkufY0SnyZlJ3WaA9mu OVL0gz6LY11P74BNnxb/tist6tZly+Y2/U6VTaHqYBs9Rjeqf58jektvTOTlfxYJi20O 0BQznkvlpSHwS+beCUeCkrZo9NQDViKEpUIgQxuJz2UYGHSkQ+oPyW1Mc1Q+UL+Vb/bv Jmqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:dkim-signature; bh=TIVrIuBqJ5quxLmtqC1YuwmBKJZnM9NMa0HAMZlUUDI=; fh=TCJk9cmfOL2IJgRxMXWohDTQ25+qNO7NeQ8UjklgAvY=; b=qIft/TGbcViMpKetlbK8qG5omGZPkHcUPtvtHqwxCsdCFRhN4aaycREknq/bm3L9N4 PY2nmhlhUDcs0Q6y5GaoqxDBI2/E74OSnG9JP3VEYN8AuTODk75u/uOtEX109oxHXl/G A6B+qD4yOEN/ML9nBOwgvOvveqiV8zpR397TsKq1S3R0nSjPZZ3fGtlTHjDuVxUI2TR5 vovpaKPKPmcFIMbOjv75J2pybm8wjeU7NCWm3Xv1vc++ka5I30V3MZd1xI9SLIUMQNG9 zsHYaaf6qjDip9/Nnj4nXO3jJNUBL2x3mwDOBO337BXzeBTs+W9McEMPEBvq3B/i02+R 11Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VTWthlC8; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k22-20020ac85fd6000000b0041959f0417bsi2462219qta.776.2023.09.28.22.07.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Sep 2023 22:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VTWthlC8; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm5iY-000803-OE; Fri, 29 Sep 2023 01:07:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm5iX-0007zb-5l for qemu-devel@nongnu.org; Fri, 29 Sep 2023 01:07:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm5iV-0004PX-8q for qemu-devel@nongnu.org; Fri, 29 Sep 2023 01:07:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695964026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TIVrIuBqJ5quxLmtqC1YuwmBKJZnM9NMa0HAMZlUUDI=; b=VTWthlC85PnhGhEGih7fMjIOsRBiThylRhgWJz/rgpeZETPhkdxGAatdBH+KVoKfTWlSu0 y+uYFv1isI32fZTMwhSANP4Q7vQUSG9GLdt8qYnwD8p/HbFqi4S7ACmUmrrfS58kG/l+1D SmhV/sh/oarFTss+q55xHBo+UeRZfRQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-288-IswbEQptM82DMKBQgH3tVQ-1; Fri, 29 Sep 2023 01:07:02 -0400 X-MC-Unique: IswbEQptM82DMKBQgH3tVQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3ECF5185A790; Fri, 29 Sep 2023 05:07:02 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B0BF2026D4B; Fri, 29 Sep 2023 05:07:02 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0C29521E6904; Fri, 29 Sep 2023 07:07:01 +0200 (CEST) From: Markus Armbruster To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, John Snow Subject: Re: [PATCH v2 11/22] hw/ide/ahci: Clean up local variable shadowing References: <20230904161235.84651-1-philmd@linaro.org> <20230904161235.84651-12-philmd@linaro.org> Date: Fri, 29 Sep 2023 07:07:01 +0200 In-Reply-To: <20230904161235.84651-12-philmd@linaro.org> ("Philippe =?utf-8?Q?Mathieu-Daud=C3=A9=22's?= message of "Mon, 4 Sep 2023 18:12:23 +0200") Message-ID: <87jzs9lg96.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: Vl3a2d3GROyR Philippe Mathieu-Daud=C3=A9 writes: > hw/ide/ahci.c:1577:23: error: declaration shadows a local variable [-We= rror,-Wshadow] > IDEState *s =3D &ad->port.ifs[j]; > ^ > hw/ide/ahci.c:1569:29: note: previous declaration is here > void ahci_uninit(AHCIState *s) > ^ > > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > hw/ide/ahci.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c > index 48d550f633..8c9a7c2117 100644 > --- a/hw/ide/ahci.c > +++ b/hw/ide/ahci.c > @@ -1573,10 +1573,8 @@ void ahci_uninit(AHCIState *s) > for (i =3D 0; i < s->ports; i++) { > AHCIDevice *ad =3D &s->dev[i]; >=20=20 > - for (j =3D 0; j < 2; j++) { > - IDEState *s =3D &ad->port.ifs[j]; > - > - ide_exit(s); > + for (j =3D 0; j < ARRAY_SIZE(ad->port.ifs); j++) { This line's change is unrelated. When we're dealing with at a huge changeset like the tree-wide -Wshadow=3Dlocal cleanup, I prefer to keep changes minimal to ease review as much as possible. But it's sunk cost now. ad->port.ifs is IDEBus member IDEState ifs[2]. .ifs[0] corresponds to .master, and .ifs[1] corresponds to .slave. Size 2 is fundamental, and will not ever change. Whether we count to 2 or to ARRAY_SIZE(.ifs) is a matter of taste. Taste is up to the maintainer, not me. John? > + ide_exit(&ad->port.ifs[j]); > } > object_unparent(OBJECT(&ad->port)); > }