Commit 0aad5850e1 for qemu.org

commit 0aad5850e102895a318f9abf86df91957fe48d93
Author: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Date:   Tue Jun 16 20:59:35 2026 -0300

    hw/riscv/sifive_u.c: remove unneeded qemu_fdt_get_phandle() call

    create_fdt() has the following code sequence:

        plic_phandle = phandle++;
        (...)
        qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle);
        plic_phandle = qemu_fdt_get_phandle(fdt, nodename);

    What this is doing is assigning a value to plic_phandle, then use that
    as phandle of "nodename", and then fetching the phandle of "nodename"
    again in the same variable that already had the right phandle val.

    Here's how it looks like in gdb:

    Thread 1 "qemu-system-ris" hit Breakpoint 1, create_fdt
         (s=0xaaaaac162a30, memmap=0xaaaaab8f70c8 <sifive_u_memmap>,
          is_32_bit=false) at ../hw/riscv/sifive_u.c:199
    199         plic_phandle = phandle++;
    (gdb) n
    200         cells =  g_new0(uint32_t, ms->smp.cpus * 4 - 2);
    (gdb) p plic_phandle
    $3 = 12
    (gdb) c
    Continuing.

    Thread 1 "qemu-system-ris" hit Breakpoint 2, create_fdt
        (s=0xaaaaac162a30, memmap=0xaaaaab8f70c8 <sifive_u_memmap>,
         is_32_bit=false) at ../hw/riscv/sifive_u.c:232
    232         plic_phandle = qemu_fdt_get_phandle(fdt, nodename);
    (gdb) n
    233         g_free(cells);
    (gdb) p plic_phandle
    $4 = 12
    (gdb)

    Remove the extra qemu_fdt_get_phandle() call.

    Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20260616235939.1358663-2-daniel.barboza@oss.qualcomm.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 0c6e4204cb..fda9a09f06 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -229,7 +229,6 @@ static void create_fdt(SiFiveUState *s, const MemMapEntry *memmap,
     qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev",
                           SIFIVE_U_PLIC_NUM_SOURCES - 1);
     qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle);
-    plic_phandle = qemu_fdt_get_phandle(fdt, nodename);
     g_free(cells);
     g_free(nodename);