Commit 1b098b3e authored by Chen Guanqiao's avatar Chen Guanqiao Committed by Simon Glass
Browse files

dm: core: fix no null pointer detection in ofnode_get_addr_size_index()



Fixed a defect of a null pointer being discovered by Coverity Scan:
   CID 331544:  Null pointer dereferences  (REVERSE_INULL)
   Null-checking "size" suggests that it may be null, but it has already been
   dereferenced on all paths leading to the check.
Signed-off-by: default avatarChen Guanqiao <chenguanqiao@kuaishou.com>
parent fd25ca32
Pipeline #8353 passed with stages
in 57 minutes and 4 seconds
...@@ -329,7 +329,8 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index, ...@@ -329,7 +329,8 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index,
{ {
int na, ns; int na, ns;
*size = FDT_SIZE_T_NONE; if (size)
*size = FDT_SIZE_T_NONE;
if (ofnode_is_np(node)) { if (ofnode_is_np(node)) {
const __be32 *prop_val; const __be32 *prop_val;
...@@ -340,6 +341,7 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index, ...@@ -340,6 +341,7 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index,
&flags); &flags);
if (!prop_val) if (!prop_val)
return FDT_ADDR_T_NONE; return FDT_ADDR_T_NONE;
if (size) if (size)
*size = size64; *size = size64;
...@@ -359,8 +361,6 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index, ...@@ -359,8 +361,6 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index,
index, na, ns, size, index, na, ns, size,
translate); translate);
} }
return FDT_ADDR_T_NONE;
} }
fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size) fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment