summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2024-08-01 10:01:30 +0200
committerHeiko Schocher <hs@denx.de>2024-08-09 14:46:05 +0200
commit6d06fdb93c13e3b989091918aaa60b04b347ab55 (patch)
tree51541f9d9cb2ca73b890cb11e432540288b1dc6f /drivers/i2c
parent3c91589a14c9a39b0e0e440b5af4273b6147a8d2 (diff)
downloadu-boot-6d06fdb93c13e3b989091918aaa60b04b347ab55.tar.gz
u-boot-6d06fdb93c13e3b989091918aaa60b04b347ab55.tar.bz2
u-boot-6d06fdb93c13e3b989091918aaa60b04b347ab55.zip
i2c: mux: Fix error path in i2c-arb-gpio
There is no reason to use goto and just call return. Better is to call return directly which is done for some if/else parts. Also make no sense to setup ret to -ETIMEDOUT and then to 0. Return timeout directly. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/muxes/i2c-arb-gpio-challenge.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
index a83d7cb082..3d2ce0ca70 100644
--- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
+++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
@@ -54,7 +54,7 @@ int i2c_arbitrator_select(struct udevice *mux, struct udevice *bus,
/* Indicate that we want to claim the bus */
ret = dm_gpio_set_value(&priv->ap_claim, 1);
if (ret)
- goto err;
+ return ret;
udelay(priv->slew_delay_us);
/* Wait for the EC to release it */
@@ -62,7 +62,7 @@ int i2c_arbitrator_select(struct udevice *mux, struct udevice *bus,
while (get_timer(start_retry) < priv->wait_retry_ms) {
ret = dm_gpio_get_value(&priv->ec_claim);
if (ret < 0) {
- goto err;
+ return ret;
} else if (!ret) {
/* We got it, so return */
return 0;
@@ -75,17 +75,14 @@ int i2c_arbitrator_select(struct udevice *mux, struct udevice *bus,
/* It didn't release, so give up, wait, and try again */
ret = dm_gpio_set_value(&priv->ap_claim, 0);
if (ret)
- goto err;
+ return ret;
mdelay(priv->wait_retry_ms);
} while (get_timer(start) < priv->wait_free_ms);
/* Give up, release our claim */
printf("I2C: Could not claim bus, timeout %lu\n", get_timer(start));
- ret = -ETIMEDOUT;
- ret = 0;
-err:
- return ret;
+ return -ETIMEDOUT;
}
static int i2c_arbitrator_probe(struct udevice *dev)