qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Yanan Wang <wangyanan55@huawei.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org,
	"Alistair Francis" <alistair.francis@wdc.com>,
	wanghaibin.wang@huawei.com,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH] softmmu/device_tree: Remove redundant pointer assignment
Date: Tue, 11 Jan 2022 10:12:08 +0100	[thread overview]
Message-ID: <20220111091208.tyawoc3yrhxvm7lm@gator> (raw)
In-Reply-To: <20220111032758.27804-1-wangyanan55@huawei.com>

On Tue, Jan 11, 2022 at 11:27:58AM +0800, Yanan Wang wrote:
> The pointer assignment "const char *p = path;" in function
> qemu_fdt_add_path is unnecessary. Let's remove it and just
> use the "path" passed in. No functional change.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
> ---
> Based on: softmmu/device_tree: Silence compiler warning with --enable-sanitizers
> https://patchew.org/QEMU/20220107133844.145039-1-thuth@redhat.com/
> ---
>  softmmu/device_tree.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c
> index 9e96f5ecd5..8897c79ea4 100644
> --- a/softmmu/device_tree.c
> +++ b/softmmu/device_tree.c
> @@ -556,7 +556,6 @@ int qemu_fdt_add_subnode(void *fdt, const char *name)
>  int qemu_fdt_add_path(void *fdt, const char *path)
>  {
>      const char *name;
> -    const char *p = path;
>      int namelen, retval;
>      int parent = 0;
>  
> @@ -565,9 +564,9 @@ int qemu_fdt_add_path(void *fdt, const char *path)
>      }
>  
>      do {
> -        name = p + 1;
> -        p = strchr(name, '/');
> -        namelen = p != NULL ? p - name : strlen(name);
> +        name = path + 1;
> +        path = strchr(name, '/');
> +        namelen = path != NULL ? path - name : strlen(name);
>  
>          retval = fdt_subnode_offset_namelen(fdt, parent, name, namelen);
>          if (retval < 0 && retval != -FDT_ERR_NOTFOUND) {
> @@ -584,7 +583,7 @@ int qemu_fdt_add_path(void *fdt, const char *path)
>          }
>  
>          parent = retval;
> -    } while (p);
> +    } while (path);
>  
>      return retval;
>  }
> -- 
> 2.27.0
>

 
Reviewed-by: Andrew Jones <drjones@redhat.com>



  reply	other threads:[~2022-01-11  9:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  3:27 [PATCH] softmmu/device_tree: Remove redundant pointer assignment Yanan Wang via
2022-01-11  9:12 ` Andrew Jones [this message]
2022-01-13  4:29 ` Alistair Francis
2022-01-13  7:47 ` Thomas Huth
2022-01-17 22:47 ` Alistair Francis

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=20220111091208.tyawoc3yrhxvm7lm@gator \
    --to=drjones@redhat.com \
    --cc=alistair.francis@wdc.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=wangyanan55@huawei.com \
    /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).