bootflow: Allow setting a cmdline arg with no value

This is supposed to be supported by the 'bootflow cmd' command, at
least according to the help. There is a 'bootflow cmd clear' but it is
often more intuitive to use 'bootcmd cmd set' with an empty value.

Update the command to pass BOOTFLOWCL_EMPTY in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-11-29 10:31:19 -07:00 committed by Tom Rini
parent 7481632b19
commit 921f63e572
2 changed files with 6 additions and 2 deletions

View file

@ -543,9 +543,9 @@ static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc,
op = argv[1];
arg = argv[2];
if (*op == 's') {
if (argc < 4)
if (argc < 3)
return CMD_RET_USAGE;
val = argv[3];
val = argv[3] ?: (const char *)BOOTFLOWCL_EMPTY;
}
switch (*op) {

View file

@ -1095,6 +1095,10 @@ static int bootflow_cmdline(struct unit_test_state *uts)
ut_asserteq(0, run_command("bootflow cmdline get mary", 0));
ut_assert_nextline_empty();
ut_asserteq(0, run_command("bootflow cmdline set mary abc", 0));
ut_asserteq(0, run_command("bootflow cmdline set mary", 0));
ut_assert_nextline_empty();
ut_assert_console_end();
return 0;