aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/fdtdec.h1
-rw-r--r--lib/fdtdec.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h
index f1e58f9..e150975 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -1061,6 +1061,7 @@ static inline int fdtdec_set_phandle(void *blob, int node, uint32_t phandle)
* @param basename base name of the node to create
* @param carveout information about the carveout region
* @param phandlep return location for the phandle of the carveout region
+ * can be NULL
* @return 0 on success or a negative error code on failure
*/
int fdtdec_add_reserved_memory(void *blob, const char *basename,
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 125d9db..38a0cff 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1309,7 +1309,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
}
if (addr == carveout->start && (addr + size) == carveout->end) {
- *phandlep = fdt_get_phandle(blob, node);
+ if (phandlep)
+ *phandlep = fdt_get_phandle(blob, node);
return 0;
}
}