1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

Add cmd_process_error() to report and process errors

U-Boot now uses errors defined in include/errno.h which are negative
integers. Commands which fail need to report the error and return 1
to indicate failure. Add this functionality in cmd_process_error().

For now this merely reports the error number. It would be possible
also to produce a helpful error message by storing the error strings
in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2014-02-26 15:59:15 -07:00
committed by Tom Rini
parent 714a5621c2
commit 16ff990246
2 changed files with 19 additions and 0 deletions

View File

@@ -538,3 +538,13 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
rc = cmd_usage(cmdtp);
return rc;
}
int cmd_process_error(cmd_tbl_t *cmdtp, int err)
{
if (err) {
printf("Command '%s' failed: Error %d\n", cmdtp->name, err);
return 1;
}
return 0;
}