diff options
-rw-r--r-- | include/fdtdec.h | 2 | ||||
-rw-r--r-- | lib/fdtdec.c | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h index e150975b27..696e0fd024 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -1061,7 +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 + * can be NULL if no phandle should be added * @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 38a0cff25e..61af3472e6 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1339,13 +1339,15 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename, if (node < 0) return node; - err = fdt_generate_phandle(blob, &phandle); - if (err < 0) - return err; - - err = fdtdec_set_phandle(blob, node, phandle); - if (err < 0) - return err; + if (phandlep) { + err = fdt_generate_phandle(blob, &phandle); + if (err < 0) + return err; + + err = fdtdec_set_phandle(blob, node, phandle); + if (err < 0) + return err; + } /* store one or two address cells */ if (na > 1) |