Commit 4eba69b463 for qemu.org

commit 4eba69b463029a3373855af7b573a309e776a5c2
Author: Osama Abdelkader <osama.abdelkader@gmail.com>
Date:   Mon Apr 20 18:21:14 2026 +0200

    hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices

    fdt_node_offset_by_compatible(fdt, -1, compat) only finds the first match.
    If the blob has more than one node with the same compatible string, extra
    nodes will remain active. Remove all the matching nodes, using the same
    loop as imx8mp-evk.c does for this purpose.

    Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
    Message-id: 20260420162114.308519-1-osama.abdelkader@gmail.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c
index 3eeb8f447e..06aeb8db01 100644
--- a/hw/arm/raspi4b.c
+++ b/hw/arm/raspi4b.c
@@ -72,12 +72,14 @@ static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)

     for (int i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) {
         const char *dev_str = nodes_to_remove[i];
+        int offset;

-        int offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
-        if (offset >= 0) {
-            if (!fdt_nop_node(fdt, offset)) {
-                warn_report("bcm2711 dtc: %s has been disabled!", dev_str);
+        offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
+        while (offset >= 0) {
+            if (fdt_nop_node(fdt, offset) == 0) {
+                warn_report("bcm2711 dtb: %s has been disabled!", dev_str);
             }
+            offset = fdt_node_offset_by_compatible(fdt, offset, dev_str);
         }
     }