summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-01-27 22:49:10 +0100
committerStefan Roese <sr@denx.de>2023-02-13 10:14:50 +0100
commit93a80c15151720f08cdbda5287a00c8b576e765f (patch)
tree5594ef836bb1804693fad5dab64bf89fe0b2b3c9 /cmd
parenta5e490f14e904fd240ccec5d364509b36a3150f9 (diff)
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>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/tlv_eeprom.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index bf8d453dc5..4591ff336b 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -479,17 +479,14 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
show_tlv_devices();
break;
default:
- cmd_usage(cmdtp);
- break;
+ return CMD_RET_USAGE;
}
return 0;
}
// The set command takes one or two args.
- if (argc > 4) {
- cmd_usage(cmdtp);
- return 0;
- }
+ if (argc > 4)
+ return CMD_RET_USAGE;
// 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
@@ -512,7 +509,7 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
current_dev = devnum;
has_been_read = 0;
} else {
- cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
}
return 0;