[PATCH 3/7] arm: boards: variscite-mx6: check i2c return value

Lucas Stach dev at lynxeye.de
Mon Oct 20 11:15:57 PDT 2014


ret wasn't checked previously.

Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
 arch/arm/boards/variscite-mx6/board.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/variscite-mx6/board.c b/arch/arm/boards/variscite-mx6/board.c
index ce1284f..de74abc 100644
--- a/arch/arm/boards/variscite-mx6/board.c
+++ b/arch/arm/boards/variscite-mx6/board.c
@@ -49,7 +49,7 @@ static int setup_pmic_voltages(void)
 	unsigned char value, rev_id = 0 ;
 	struct i2c_adapter *adapter = NULL;
 	struct i2c_client client;
-	int addr = -1, ret, bus = 0;
+	int addr = -1, bus = 0;
 
 	/* I2C2 bus (2-1 = 1 in barebox numbering) */
 	bus = 1;
@@ -80,7 +80,10 @@ static int setup_pmic_voltages(void)
 
 	/* Set Gigabit Ethernet voltage (SOM v1.1/1.0)*/
         value = 0x60;
-	ret = i2c_write_reg(&client, 0x4a, &value, 1);
+	if (i2c_write_reg(&client, 0x4a, &value, 1) != 1) {
+		pr_err("Set ETH error!\n");
+		return -EIO;
+	}
 
 	/* set VGEN3 to 2.5V */
 	value = 0x77;
-- 
1.9.3




More information about the barebox mailing list