qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Cédric Le Goater" <clg@kaod.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH 3/4] aspeed/i3c: Rename variable shadowing a local
Date: Fri, 22 Sep 2023 20:28:58 +0200	[thread overview]
Message-ID: <1a6c49b1-5e5e-481d-96d8-8c08d5aefcdc@linaro.org> (raw)
In-Reply-To: <20230922155924.1172019-4-clg@kaod.org>

On 22/9/23 17:59, Cédric Le Goater wrote:
> to fix warning :
> 
>    ../hw/i3c/aspeed_i3c.c: In function ‘aspeed_i3c_realize’:
>    ../hw/i3c/aspeed_i3c.c:1959:17: warning: declaration of ‘dev’ shadows a parameter [-Wshadow=local]
>     1959 |         Object *dev = OBJECT(&s->devices[i]);
>          |                 ^~~
>    ../hw/i3c/aspeed_i3c.c:1942:45: note: shadowed declaration is here
>     1942 | static void aspeed_i3c_realize(DeviceState *dev, Error **errp)
>          |                                ~~~~~~~~~~~~~^~~
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>   hw/misc/aspeed_i3c.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/misc/aspeed_i3c.c b/hw/misc/aspeed_i3c.c
> index f54f5da522b3..d1ff61767167 100644
> --- a/hw/misc/aspeed_i3c.c
> +++ b/hw/misc/aspeed_i3c.c
> @@ -296,13 +296,13 @@ static void aspeed_i3c_realize(DeviceState *dev, Error **errp)

Alternatively:

-- >8 --

-static void aspeed_i3c_realize(DeviceState *dev, Error **errp)
+static void aspeed_i3c_realize(DeviceState *ctrl, Error **errp)
  {
      int i;
-    AspeedI3CState *s = ASPEED_I3C(dev);
-    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    AspeedI3CState *s = ASPEED_I3C(ctrl);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(ctrl);

---

>       memory_region_add_subregion(&s->iomem_container, 0x0, &s->iomem);
>   
>       for (i = 0; i < ASPEED_I3C_NR_DEVICES; ++i) {
> -        Object *dev = OBJECT(&s->devices[i]);
> +        Object *i3c_dev = OBJECT(&s->devices[i]);
>   
> -        if (!object_property_set_uint(dev, "device-id", i, errp)) {
> +        if (!object_property_set_uint(i3c_dev, "device-id", i, errp)) {
>               return;
>           }
>   
> -        if (!sysbus_realize(SYS_BUS_DEVICE(dev), errp)) {
> +        if (!sysbus_realize(SYS_BUS_DEVICE(i3c_dev), errp)) {
>               return;
>           }
>   

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2023-09-24 14:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 15:59 [PATCH 0/4] aspeed: Clean up local variable shadowing Cédric Le Goater
2023-09-22 15:59 ` [PATCH 1/4] aspeed/i2c: " Cédric Le Goater
2023-09-22 18:22   ` Philippe Mathieu-Daudé
2023-09-27  2:38   ` Joel Stanley
2023-09-22 15:59 ` [PATCH 2/4] aspeed: " Cédric Le Goater
2023-09-22 18:23   ` Philippe Mathieu-Daudé
2023-09-23  6:34   ` Markus Armbruster
2023-09-23  7:10     ` Cédric Le Goater
2023-09-22 15:59 ` [PATCH 3/4] aspeed/i3c: Rename variable shadowing a local Cédric Le Goater
2023-09-22 18:28   ` Philippe Mathieu-Daudé [this message]
2023-09-25  6:29     ` Andrew Jeffery
2023-09-22 15:59 ` [PATCH 4/4] aspeed/timer: Clean up local variable shadowing Cédric Le Goater
2023-09-22 18:32   ` Philippe Mathieu-Daudé
2023-09-22 18:20 ` [PATCH 0/4] aspeed: " Philippe Mathieu-Daudé
2023-09-22 19:00   ` Cédric Le Goater
2023-09-23  7:13     ` Markus Armbruster
2023-09-25 16:28       ` Cédric Le Goater
2023-09-26  6:44         ` Markus Armbruster
2023-09-29  6:46 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a6c49b1-5e5e-481d-96d8-8c08d5aefcdc@linaro.org \
    --to=philmd@linaro.org \
    --cc=andrew@aj.id.au \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).