diff options
author | Clement Leger <cleger@kalray.eu> | 2020-03-20 17:07:20 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-03-23 08:19:03 +0100 |
commit | 8fb804c55b8ddf8edbf73489ee062f7d437adcf6 (patch) | |
tree | 9ab85fd7e25a273208058da9f2e7d1771a62e9e9 /common/oftree.c | |
parent | ce70a158ccf3da0d025d5f7059229a659b329ff2 (diff) | |
download | barebox-8fb804c55b8ddf8edbf73489ee062f7d437adcf6.tar.gz barebox-8fb804c55b8ddf8edbf73489ee062f7d437adcf6.tar.xz |
common: oftree: trim leading spaces from bootargs
When barebox concatenates all dynamic bootargs string for linux, if they
are empty, the resulting string might be composed of only spaces.
Currently, there is no check for such string and it leads to
overwriting bootargs in the device tree by an empty string. To avoid
this behavior, use skip_spaces to trim leading spaces and then check if
the string is empty. If so, simply returns and don't patch device tree
bootargs.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/oftree.c')
-rw-r--r-- | common/oftree.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/oftree.c b/common/oftree.c index 09cb660212..36906e86fc 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -151,6 +151,10 @@ static int of_fixup_bootargs(struct device_node *root, void *unused) if (!str) return 0; + str = skip_spaces(str); + if (strlen(str) == 0) + return 0; + node = of_create_node(root, "/chosen"); if (!node) return -ENOMEM; |