commonlib/device_tree: Make *path const in dt_find_node()

dt_find_node() looks up nodes specified by the `const char **path`
array, without modifying the strings in the array. Therefore, the char
pointers in the array could be changed to const.

Change-Id: I8d330e78d0977bae54996bb622190f6546fcb59f
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87653
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
Yu-Ping Wu 2025-05-13 09:40:33 +08:00 committed by Matt DeVillier
commit 85972101e6
2 changed files with 5 additions and 4 deletions

View file

@ -1039,7 +1039,7 @@ void dt_read_cell_props(const struct device_tree_node *node, u32 *addrcp,
}
static struct device_tree_node *_dt_find_node(struct device_tree_node *parent,
const char **path, u32 *addrcp,
const char *const *path, u32 *addrcp,
u32 *sizecp, int create)
{
struct device_tree_node *node, *found = NULL;
@ -1091,7 +1091,7 @@ static struct device_tree_node *_dt_find_node(struct device_tree_node *parent,
* @return The found/created node, or NULL.
*/
struct device_tree_node *dt_find_node(struct device_tree_node *parent,
const char **path, u32 *addrcp,
const char *const *path, u32 *addrcp,
u32 *sizecp, int create)
{
/* Initialize cells to default values according to FDT spec. */

View file

@ -154,8 +154,9 @@ void dt_read_cell_props(const struct device_tree_node *node, u32 *addrcp,
u32 *sizecp);
/* Look up or create a node relative to a parent node, through its path
represented as an array of strings. */
struct device_tree_node *dt_find_node(struct device_tree_node *parent, const char **path,
u32 *addrcp, u32 *sizecp, int create);
struct device_tree_node *dt_find_node(struct device_tree_node *parent,
const char *const *path, u32 *addrcp,
u32 *sizecp, int create);
struct device_tree_node *dt_find_node_by_phandle(struct device_tree_node *root,
uint32_t phandle);
/* Look up or create a node in the tree, through its path