summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko.stuebner@theobroma-systems.com>2019-10-23 17:46:39 +0300
committerSimon Glass <sjg@chromium.org>2019-11-14 16:09:34 +0300
commit357d2ceba0354e29462ac25924f5e42623c22b5b (patch)
treef03173ccfa5d3db2b6bb0d738590a9e37467fd39 /lib
parent086336a22508affb7567bf6d383642554eda5a56 (diff)
downloadu-boot-357d2ceba0354e29462ac25924f5e42623c22b5b.tar.xz
fdtdec: only create phandle if caller wants it in fdtdec_add_reserved_memory()
The phandlep pointer returning the phandle to the caller is optional and if it is not set when calling fdtdec_add_reserved_memory() it is highly likely that the caller is not interested in a phandle to the created reserved-memory area and really just wants that area added. So just don't create a phandle in that case. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/fdtdec.c16
1 files changed, 9 insertions, 7 deletions
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)