Add error messages when file list parsing fails. Also, forward the error from file_list_parse_one() instead of using -EINVAL for every error. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- common/file-list.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common/file-list.c b/common/file-list.c index 0c3cb0a4e7..8d61b76cbb 100644 --- a/common/file-list.c +++ b/common/file-list.c @@ -9,6 +9,8 @@ * General Public License for more details. */ +#define pr_fmt(fmt) "file_list: " fmt + #include <common.h> #include <malloc.h> #include <fs.h> @@ -91,6 +93,7 @@ static int file_list_parse_one(struct file_list *files, const char *partstr, con flags |= FILE_LIST_FLAG_CREATE; break; default: + pr_err("Unknown flag '%c'\n", *partstr); return -EINVAL; } break; @@ -100,8 +103,10 @@ static int file_list_parse_one(struct file_list *files, const char *partstr, con partstr++; } - if (state != PARSE_FLAGS) + if (state != PARSE_FLAGS) { + pr_err("Missing ')'\n"); return -EINVAL; + } if (*partstr == ',') partstr++; @@ -121,9 +126,9 @@ struct file_list *file_list_parse(const char *str) INIT_LIST_HEAD(&files->list); while (*str) { - if (file_list_parse_one(files, str, &endptr)) { - printf("parse error\n"); - ret = -EINVAL; + ret = file_list_parse_one(files, str, &endptr); + if (ret) { + pr_err("parse error\n"); goto out; } str = endptr; -- 2.11.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox