command_ret_t enum contains 3 return values but only two are handled
now. Extend cmd_process_error() and handle CMD_RET_USAGE separately.
These commands are affected by this change.
cmd/demo.c
cmd/efi.c
cmd/gpio.c
cmd/qfw.c
cmd/x86/fsp.c
test/dm/cmd_dm.c
And scripts shouldn't be affected because return value is not 0. But
every command implementation can choose what it is correct to pass.
I would expect that RET_USAGE is called when parameters are not
correctly passed (have incorrect value, missing parameters)
and RET_FAILURE when correct parameters are passed but command fails.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromum.org>
int cmd_process_error(cmd_tbl_t *cmdtp, int err)
{
+ if (err == CMD_RET_USAGE)
+ return CMD_RET_USAGE;
+
if (err) {
printf("Command '%s' failed: Error %d\n", cmdtp->name, err);
return CMD_RET_FAILURE;
*
* @cmdtp: Command which caused the error
* @err: Error code (0 if none, -ve for error, like -EIO)
- * @return 0 if there is not error, 1 (CMD_RET_FAILURE) if an error is found
+ * @return 0 (CMD_RET_SUCCESX) if there is not error,
+ * 1 (CMD_RET_FAILURE) if an error is found
+ * -1 (CMD_RET_USAGE) if 'usage' error is found
*/
int cmd_process_error(cmd_tbl_t *cmdtp, int err);