Commit 4fbd258e69373a60cdf24c9a64065b486f8748c9
1 parent
4a1db6d8ab
Exists in
v2017.01-smarct4x
and in
30 other branches
i2c: Correct command return values
We should not return a -ve error code from command functions. Instead, return CMD_RET_FAILURE. This avoids the "exit not allowed from main input shell" error messages from the hush shell. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
common/cmd_i2c.c
... | ... | @@ -1809,7 +1809,8 @@ |
1809 | 1809 | if (ret) |
1810 | 1810 | printf("Failure changing bus number (%d)\n", ret); |
1811 | 1811 | } |
1812 | - return ret; | |
1812 | + | |
1813 | + return ret ? CMD_RET_FAILURE : 0; | |
1813 | 1814 | } |
1814 | 1815 | #endif /* defined(CONFIG_SYS_I2C) */ |
1815 | 1816 | |
... | ... | @@ -1852,7 +1853,8 @@ |
1852 | 1853 | if (ret) |
1853 | 1854 | printf("Failure changing bus speed (%d)\n", ret); |
1854 | 1855 | } |
1855 | - return ret; | |
1856 | + | |
1857 | + return ret ? CMD_RET_FAILURE : 0; | |
1856 | 1858 | } |
1857 | 1859 | |
1858 | 1860 | /** |