From 85972101e66c584b3cdf0b6f1322e794e6bcef72 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Tue, 13 May 2025 09:40:33 +0800 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/87653 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- src/commonlib/device_tree.c | 4 ++-- src/commonlib/include/commonlib/device_tree.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/commonlib/device_tree.c b/src/commonlib/device_tree.c index b5c0ede7f3..c4fbae986d 100644 --- a/src/commonlib/device_tree.c +++ b/src/commonlib/device_tree.c @@ -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. */ diff --git a/src/commonlib/include/commonlib/device_tree.h b/src/commonlib/include/commonlib/device_tree.h index c15d7ae5b1..f51f827593 100644 --- a/src/commonlib/include/commonlib/device_tree.h +++ b/src/commonlib/include/commonlib/device_tree.h @@ -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