@samitouri / QOSamiQemu / commits / 4eba69b463

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>

Osama Abdelkader committed Apr 20, 2026 at 18:21 UTC 4eba69b463029a3373855af7b573a309e776a5c2
1 file changed +6 -4
hw/arm/raspi4b.c
+6 -4
@@ -72,12 +72,14 @@ static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)
72
73 for (int i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) {
74 const char *dev_str = nodes_to_remove[i];
75 + int offset;
76
76 - int offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
77 - if (offset >= 0) {
78 - if (!fdt_nop_node(fdt, offset)) {
79 - warn_report("bcm2711 dtc: %s has been disabled!", dev_str);
77 + offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
78 + while (offset >= 0) {
79 + if (fdt_nop_node(fdt, offset) == 0) {
80 + warn_report("bcm2711 dtb: %s has been disabled!", dev_str);
81 }
82 + offset = fdt_node_offset_by_compatible(fdt, offset, dev_str);
83 }
84 }
85