summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Gunasekaran <r-gunasekaran@ti.com>2023-05-19 09:57:38 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-05-19 06:40:43 -0500
commitd8914049bf6491f1e95cb005d822d2a4f43c485b (patch)
tree27b51d059cddec9c3b011fd2fb08455aa3f87148
parentf2434c3ea2ddfd01c585d2ed0ec3d75ff52f6816 (diff)
common: dfu: Remove leading space characters
As per [1], dfu_alt_info is mentioned to be as semicolon separated string of information on each alternate and the parsing logic in the dfu.c is based on this. Typically, the dfu_alt_info_* is defined in .h files as preprocessor macros with 'alt' info separated by semicolon. But when dfu_alt_info_* is added in the environment files(.env) the script at "scripts/env2string.awk" converts a newline to space. Thus adding a space character after semicolon. This results in incorrect parsing in dfu.c which is based on the information that 'alt' info are only semicolon separated. One option is to add dfu_alt_info_* variable in .env in single line. But there is possiblity for it to exceed the line length limit. So update the parsing logic to remove leading space characters before adding to the dfu list. [1]: https://u-boot.readthedocs.io/en/latest/usage/dfu.html Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
-rw-r--r--drivers/dfu/dfu.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 516dda61796..b2ee5f1ede6 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -135,6 +135,7 @@ int dfu_config_interfaces(char *env)
a = s;
do {
part = strsep(&a, ";");
+ part = skip_spaces(part);
ret = dfu_alt_add(dfu, i, d, part);
if (ret)
return ret;
@@ -629,6 +630,7 @@ int dfu_config_entities(char *env, char *interface, char *devstr)
for (i = 0; i < dfu_alt_num; i++) {
s = strsep(&env, ";");
+ s = skip_spaces(s);
ret = dfu_alt_add(dfu, interface, devstr, s);
if (ret) {
/* We will free "dfu" in dfu_free_entities() */