cmd: return code when tlv_eeprom incorrectly called

A command called with incorrect parameters should set $? to 1 (false).
Instead of calling cmd_usage(cmdtp) and then returning 0 just return
CMD_RET_FAILURE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
Heinrich Schuchardt 2023-01-27 22:49:10 +01:00 committed by Stefan Roese
parent a5e490f14e
commit 93a80c1515
1 changed files with 4 additions and 7 deletions

View File

@ -479,17 +479,14 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
show_tlv_devices(); show_tlv_devices();
break; break;
default: default:
cmd_usage(cmdtp); return CMD_RET_USAGE;
break;
} }
return 0; return 0;
} }
// The set command takes one or two args. // The set command takes one or two args.
if (argc > 4) { if (argc > 4)
cmd_usage(cmdtp); return CMD_RET_USAGE;
return 0;
}
// Set command. If the TLV exists in the EEPROM, delete it. Then if // Set command. If the TLV exists in the EEPROM, delete it. Then if
// data was supplied for this TLV add the TLV with the new contents at // data was supplied for this TLV add the TLV with the new contents at
@ -512,7 +509,7 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
current_dev = devnum; current_dev = devnum;
has_been_read = 0; has_been_read = 0;
} else { } else {
cmd_usage(cmdtp); return CMD_RET_USAGE;
} }
return 0; return 0;