[PATCH v2 3/3] lib: fix irqchip_plic_update_hartid_table

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed Dec 7 17:14:21 PST 2022


After determining cpu_offset we have to check this value.

Addresses-Coverity-ID: 1529706 ("Logically dead code")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
Reviewed-by: Xiang W <wxjstz at 126.com>
Reviewed-by: Atish Patra <atishp at rivosinc.com>
---
v2:
	add reviewed-by lines
---
 lib/utils/irqchip/fdt_irqchip_plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/irqchip/fdt_irqchip_plic.c b/lib/utils/irqchip/fdt_irqchip_plic.c
index a6e185c..fe08836 100644
--- a/lib/utils/irqchip/fdt_irqchip_plic.c
+++ b/lib/utils/irqchip/fdt_irqchip_plic.c
@@ -86,7 +86,7 @@ static int irqchip_plic_update_hartid_table(void *fdt, int nodeoff,
 			continue;
 
 		cpu_offset = fdt_parent_offset(fdt, cpu_intc_offset);
-		if (cpu_intc_offset < 0)
+		if (cpu_offset < 0)
 			continue;
 
 		err = fdt_parse_hart_id(fdt, cpu_offset, &hartid);
-- 
2.37.2




More information about the opensbi mailing list