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>
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 552c875..b3bb644 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1809,7 +1809,8 @@
if (ret)
printf("Failure changing bus number (%d)\n", ret);
}
- return ret;
+
+ return ret ? CMD_RET_FAILURE : 0;
}
#endif /* defined(CONFIG_SYS_I2C) */
@@ -1852,7 +1853,8 @@
if (ret)
printf("Failure changing bus speed (%d)\n", ret);
}
- return ret;
+
+ return ret ? CMD_RET_FAILURE : 0;
}
/**