Commit 38f413ce authored by Marek Vasut's avatar Marek Vasut

mxssb: Fixup handling of multiple sections

In case the parser comes across another section, it should return
into the section loop instead of treating it as an unknown instruction.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent 5f5ec1e9
...@@ -490,6 +490,11 @@ static int sb_tag_to_command(struct sb_cmd_ctx *cctx, char *line) ...@@ -490,6 +490,11 @@ static int sb_tag_to_command(struct sb_cmd_ctx *cctx, char *line)
return 0; return 0;
} }
len = strlen(tok); len = strlen(tok);
/* Next section, return. */
if ((len == 7) && !strncmp(tok, "SECTION", 7))
return -ENOMSG;
if ((len != 3) && (len != 4)) { if ((len != 3) && (len != 4)) {
fprintf(stderr, "WARN: Unknown command!\n"); fprintf(stderr, "WARN: Unknown command!\n");
return -EINVAL; return -EINVAL;
...@@ -645,7 +650,12 @@ static int sb_parse_cmds(struct sb_section_ctx *sctx, struct sb_image_ctx *ictx) ...@@ -645,7 +650,12 @@ static int sb_parse_cmds(struct sb_section_ctx *sctx, struct sb_image_ctx *ictx)
head = cctx; head = cctx;
ret = sb_tag_to_command(cctx, line); ret = sb_tag_to_command(cctx, line);
if (ret) if (ret == -ENOMSG) {
free(line);
free(cctx);
ret = 0;
break;
} else if (ret)
goto err; goto err;
len += sizeof(struct sb_command); len += sizeof(struct sb_command);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment