hw/ppc: use 0 instead of fdt_path_offset(fdt, "/")
authorGreg Kurz <groug@kaod.org>
Tue, 3 Oct 2017 14:13:11 +0000 (16:13 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 16 Oct 2017 23:34:00 +0000 (10:34 +1100)
The offset of the root node is guaranteed to be 0.

This doesn't fix anything, it's just trivial cleanup of the two
remaining places where this was done under hw/ppc.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/pnv.c
hw/ppc/spapr.c

index d46d91c76f5cdf7d7e6374c8f400fb09e1c6dbc8..84b2389ea60bc42e76e2452f154472b42d81a35b 100644 (file)
@@ -92,8 +92,7 @@ static int get_cpus_node(void *fdt)
     int cpus_offset = fdt_path_offset(fdt, "/cpus");
 
     if (cpus_offset < 0) {
-        cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
-                                      "cpus");
+        cpus_offset = fdt_add_subnode(fdt, 0, "cpus");
         if (cpus_offset) {
             _FDT((fdt_setprop_cell(fdt, cpus_offset, "#address-cells", 0x1)));
             _FDT((fdt_setprop_cell(fdt, cpus_offset, "#size-cells", 0x0)));
index ff87f155d55ec3d216ed8a2f62e2ea1148d9b0e3..352ff3d614e8ee765804cd1659c7438cb205baea 100644 (file)
@@ -353,8 +353,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)
 
         cpus_offset = fdt_path_offset(fdt, "/cpus");
         if (cpus_offset < 0) {
-            cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
-                                          "cpus");
+            cpus_offset = fdt_add_subnode(fdt, 0, "cpus");
             if (cpus_offset < 0) {
                 return cpus_offset;
             }