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: Chen Guanqiao <chenguanqiao@kuaishou.com>
{
int na, ns;
- *size = FDT_SIZE_T_NONE;
+ if (size)
+ *size = FDT_SIZE_T_NONE;
if (ofnode_is_np(node)) {
const __be32 *prop_val;
&flags);
if (!prop_val)
return FDT_ADDR_T_NONE;
+
if (size)
*size = size64;
index, na, ns, size,
translate);
}
-
- return FDT_ADDR_T_NONE;
}
fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size)