diff options
author | Alexander Dahl <ada@thorsis.com> | 2019-06-28 14:41:24 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2019-07-30 10:21:16 +0200 |
commit | 5a4675a9171785475b49eb8ad0778dc28a6d8746 (patch) | |
tree | 23bd3aa989a6fdb03ed28ccc28079364e5702238 /include | |
parent | b283d6ba67a7b4c5914949ef1d756bf88cb3a0e4 (diff) | |
download | u-boot-5a4675a9171785475b49eb8ad0778dc28a6d8746.tar.gz u-boot-5a4675a9171785475b49eb8ad0778dc28a6d8746.tar.bz2 u-boot-5a4675a9171785475b49eb8ad0778dc28a6d8746.zip |
cmd: fpga: Change return value to avoid printing usage text
In cmd/fpga.c the commands should return enum command_ret_t, e.g.
CMD_RET_USAGE, CMD_RET_SUCCESS, or CMD_RET_FAILURE. What they actually
do is passing a return value from different 'fpga_' functions.
Passing on a return value of -1 from a called function leads to printing
out usage text. In case of actually correct usage with correctly
specified parameters but some fail at runtime printing out that usage
text is distracting.
The reason is most 'fpga_' functions return either FPGA_SUCCESS or
FPGA_FAIL, the latter was equal to -1 which is the same value as
CMD_RET_USAGE. So just passing on FPGA_FAIL lead to printing out usage.
We should only return CMD_RET_USAGE in cases, where the user sent wrong
input. Every other case should return CMD_RET_SUCCESS or
CMD_RET_FAILURE, and not simply pass an error code.
Simply changing FPGA_FAIL from -1 to 1 gets the job done.
Suggested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/fpga.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/fpga.h b/include/fpga.h index 51de5c55f8..ec5144334d 100644 --- a/include/fpga.h +++ b/include/fpga.h @@ -15,7 +15,7 @@ /* fpga_xxxx function return value definitions */ #define FPGA_SUCCESS 0 -#define FPGA_FAIL -1 +#define FPGA_FAIL 1 /* device numbers must be non-negative */ #define FPGA_INVALID_DEVICE -1 |