summaryrefslogtreecommitdiff
path: root/src/lib/device_tree.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-05-13 17:30:31 -0700
committerPatrick Georgi <pgeorgi@google.com>2019-06-04 11:24:46 +0000
commit0e9116f0a12c0a2a8142978458d3266e5e9aacdc (patch)
tree1adea4fe38a37f720252f832f3513d89dd3544cb /src/lib/device_tree.c
parent0d74653bd46a360466cf5050ea0c102fc11cdc2d (diff)
downloadcoreboot-0e9116f0a12c0a2a8142978458d3266e5e9aacdc.tar.xz
device_tree: Make FDT property data non-const
FDT property data should not be const -- sometimes we need to update it, for example when fixing up phandles in an overlay. On the other hand it's occasionally desirable to put a string constant in there without having to strdup() it all the time... let's just live with the tiny implicit assumption that the data we'd want to modify (phandle references, mostly) will never be added from string constants, and put a cast in dt_add_string_prop(). Change-Id: Ifac103fcff0520cc427ab9a2aa141c65e12507ac Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32868 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/lib/device_tree.c')
-rw-r--r--src/lib/device_tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index 3c4bd24462..a5021ca8fd 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -883,7 +883,7 @@ void dt_delete_prop(struct device_tree_node *node, const char *name)
* @param size The size of data in bytes.
*/
void dt_add_bin_prop(struct device_tree_node *node, const char *name,
- const void *data, size_t size)
+ void *data, size_t size)
{
struct device_tree_property *prop;
@@ -955,7 +955,7 @@ void dt_find_bin_prop(const struct device_tree_node *node, const char *name,
void dt_add_string_prop(struct device_tree_node *node, const char *name,
const char *str)
{
- dt_add_bin_prop(node, name, str, strlen(str) + 1);
+ dt_add_bin_prop(node, name, (char *)str, strlen(str) + 1);
}
/*