]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
layerscape: fdt.c: Check for NULL return value from fdt_getprop()
authorPriyanka Singh <priyanka.singh@nxp.com>
Mon, 2 Nov 2020 06:08:41 +0000 (11:38 +0530)
committerPriyanka Jain <priyanka.jain@nxp.com>
Thu, 10 Dec 2020 08:26:39 +0000 (13:56 +0530)
Check for NULL return value from fdt_getprop() in
fdt_fixup_remove_jr()

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
[Fixed checkpatch errors/warnings]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
arch/arm/cpu/armv8/fsl-layerscape/fdt.c

index 6d3391db3b320f84c2bb1f05a0a0e95cb217b2db..3a04dce56fb9e19d2b1b40211ff501e16b2b2ba4 100644 (file)
@@ -400,10 +400,12 @@ 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) {
+                       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");