mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-17 14:18:14 +01:00
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>
This commit is contained in:
parent
086336a225
commit
357d2ceba0
@ -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 basename base name of the node to create
|
||||||
* @param carveout information about the carveout region
|
* @param carveout information about the carveout region
|
||||||
* @param phandlep return location for the phandle of 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
|
* @return 0 on success or a negative error code on failure
|
||||||
*/
|
*/
|
||||||
int fdtdec_add_reserved_memory(void *blob, const char *basename,
|
int fdtdec_add_reserved_memory(void *blob, const char *basename,
|
||||||
|
14
lib/fdtdec.c
14
lib/fdtdec.c
@ -1339,13 +1339,15 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
|
|||||||
if (node < 0)
|
if (node < 0)
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
err = fdt_generate_phandle(blob, &phandle);
|
if (phandlep) {
|
||||||
if (err < 0)
|
err = fdt_generate_phandle(blob, &phandle);
|
||||||
return err;
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
err = fdtdec_set_phandle(blob, node, phandle);
|
err = fdtdec_set_phandle(blob, node, phandle);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/* store one or two address cells */
|
/* store one or two address cells */
|
||||||
if (na > 1)
|
if (na > 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user