diff options
author | Simon Glass <sjg@chromium.org> | 2022-09-07 05:27:03 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-29 23:07:58 +0300 |
commit | c3a194dec97be3ceb74ba2c980e635aee1644d94 (patch) | |
tree | 3a6cc834b0952633c6a9b6684a65bcbaaa28361c /drivers | |
parent | ffe90392497898ccd8000e695901853e192a9007 (diff) | |
download | u-boot-c3a194dec97be3ceb74ba2c980e635aee1644d94.tar.xz |
dm: core: Support writing a property to an empty node
At present this does not work with livetree. Fix it and add a test.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/of_access.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index de6327199a..8631e1c286 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -947,9 +947,6 @@ int of_write_prop(struct device_node *np, const char *propname, int len, pp_last = pp; } - if (!pp_last) - return -ENOENT; - /* Property does not exist -> append new property */ new = malloc(sizeof(struct property)); if (!new) @@ -965,7 +962,10 @@ int of_write_prop(struct device_node *np, const char *propname, int len, new->length = len; new->next = NULL; - pp_last->next = new; + if (pp_last) + pp_last->next = new; + else + np->properties = new; return 0; } |