On 2022/1/8 4:18, Richard Henderson wrote:
On 1/7/22 5:38 AM, Thomas Huth wrote:
diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c
index 3965c834ca..9e96f5ecd5 100644
--- a/softmmu/device_tree.c
+++ b/softmmu/device_tree.c
@@ -564,7 +564,7 @@ int qemu_fdt_add_path(void *fdt, const char *path)
          return -1;
      }
  -    while (p) {
+    do {
          name = p + 1;
          p = strchr(name, '/');
          namelen = p != NULL ? p - name : strlen(name);
@@ -584,7 +584,7 @@ int qemu_fdt_add_path(void *fdt, const char *path)
          }
            parent = retval;
-    }
+    } while (p);

Reviewed-by: Richard Henderson <richard.hender...@linaro.org>

In addition, the copy between 'path' and 'p' is unnecessary -- one of the variables should be removed.  Either rename the parameter to 'p', or rename all uses to 'path'.

Yes. We can simply remove "const char *p = path;" and directly
using the parameter "path" passed in would be fine enough.
Thanks for catching this.

Thanks,
Yanan

r~
.


Reply via email to