Commit ea88b671 authored by Marek Vasut's avatar Marek Vasut

mxssb: Rework the input/output file checking

Rework the condition that checks whether user supplied the input/output
and configuration filenames correctly so that clang does not complain.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent fe36d1e7
......@@ -1827,18 +1827,10 @@ int main(int argc, char **argv)
return -EINVAL;
}
if (!(input_filename || (ctx.cfg_filename && output_filename)) ||
(input_filename && (ctx.cfg_filename && output_filename))) {
fprintf(stderr, "ERR: Please specify either input filename or\n"
" configuration file and output filename!\n");
print_help(argv[0]);
return -EINVAL;
}
if (input_filename) {
if (input_filename && !(ctx.cfg_filename || output_filename)) {
/* Image verification and dump. */
ret = sb_build_tree_from_img(&ctx);
} else if (ctx.cfg_filename && output_filename) {
} else if (!input_filename && (ctx.cfg_filename && output_filename)) {
/* Image creation */
ret = sb_build_tree_from_cfg(&ctx);
if (ret)
......@@ -1847,6 +1839,11 @@ int main(int argc, char **argv)
ret = sb_encrypt_image(&ctx);
if (!ret)
ret = sb_write_image(&ctx);
} else {
fprintf(stderr, "ERR: Please specify either input filename or\n"
" configuration file and output filename!\n");
print_help(argv[0]);
return -EINVAL;
}
fail:
......
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