[PATCH 1/1] layerscape: fdt.c: Check for NULL return value from fdt_getprop()

Priyanka Singh priyanka.singh at nxp.com
Mon Nov 2 07:08:41 CET 2020


Check for NULL return value from fdt_getprop() in fdt_fixup_remove_jr()

Signed-off-by: Priyanka Singh <priyanka.singh at nxp.com>
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index f5f75fa452..5fc17a7233 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -391,10 +391,13 @@ void fdt_fixup_remove_jr(void *blob)
 
 	while (jr_node != -FDT_ERR_NOTFOUND) {
 		reg = (fdt32_t *)fdt_getprop(blob, jr_node, "reg", &len);
-		jr_offset = fdt_read_number(reg, addr_cells);
-		if (jr_offset == used_jr) {
-			fdt_del_node(blob, jr_node);
-			break;
+		if(reg != NULL)
+		{
+			jr_offset = fdt_read_number(reg, addr_cells);
+			if (jr_offset == used_jr) {
+				fdt_del_node(blob, jr_node);
+				break;
+			}
 		}
 		jr_node = fdt_node_offset_by_compatible(blob, jr_node,
 							"fsl,sec-v4.0-job-ring");
-- 
2.17.1



More information about the U-Boot mailing list