diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2020-03-31 11:47:03 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-04-01 07:39:38 +0200 |
commit | 1a414ba273f9d8825957ce7b55b135c3b8e2b67a (patch) | |
tree | a5f419a5ba87fe3e4dae3e0cefd0cc5a826689fd | |
parent | eb610d5ec8486f49c3c65125ec91e66cfe858f96 (diff) | |
download | barebox-1a414ba273f9d8825957ce7b55b135c3b8e2b67a.tar.gz barebox-1a414ba273f9d8825957ce7b55b135c3b8e2b67a.tar.xz |
ARM: zii-common: Check for I2C errors in do_rdu2_switch_reset()
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/boards/zii-common/switch-cmd.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/arch/arm/boards/zii-common/switch-cmd.c b/arch/arm/boards/zii-common/switch-cmd.c index 2b9c34bfac..5e39d8fc69 100644 --- a/arch/arm/boards/zii-common/switch-cmd.c +++ b/arch/arm/boards/zii-common/switch-cmd.c @@ -19,6 +19,7 @@ static int do_rdu2_switch_reset(void) { struct i2c_client client; + int ret; u8 reg; client.adapter = i2c_get_adapter(1); @@ -29,12 +30,25 @@ static int do_rdu2_switch_reset(void) client.addr = 0x38; reg = 0x78; /* set switch reset time to 100ms */ - i2c_write_reg(&client, 0x0a, ®, 1); + + ret = i2c_write_reg(&client, 0x0a, ®, 1); + if (ret < 0) { + pr_err("Failed to set switch reset time\n"); + return ret; + } /* reset the switch */ reg = 0x01; - i2c_write_reg(&client, 0x0d, ®, 1); + ret = i2c_write_reg(&client, 0x0d, ®, 1); + if (ret < 0) { + pr_err("Failed to reset the switch\n"); + return ret; + } /* issue dummy command to work around firmware bug */ - i2c_read_reg(&client, 0x01, ®, 1); + ret = i2c_read_reg(&client, 0x01, ®, 1); + if (ret < 0) { + pr_err("Failed to issue a dummy command\n"); + return ret; + } return 0; } |