From 22599b795c8395fa3e2a90c3b32ca1622035feeb Mon Sep 17 00:00:00 2001 From: Yanan Wang Date: Tue, 11 Jan 2022 11:27:58 +0800 Subject: [PATCH] softmmu/device_tree: Remove redundant pointer assignment 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 Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis Reviewed-by: Thomas Huth Message-id: 20220111032758.27804-1-wangyanan55@huawei.com Signed-off-by: Alistair Francis --- 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 0a433c98e2..6ca3fad285 100644 --- a/softmmu/device_tree.c +++ b/softmmu/device_tree.c @@ -558,7 +558,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; @@ -567,9 +566,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) { @@ -586,7 +585,7 @@ int qemu_fdt_add_path(void *fdt, const char *path) } parent = retval; - } while (p); + } while (path); return retval; }