mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 10:24:49 +00:00
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>
This commit is contained in:
parent
3c91589a14
commit
6d06fdb93c
1 changed files with 4 additions and 7 deletions
|
@ -54,7 +54,7 @@ int i2c_arbitrator_select(struct udevice *mux, struct udevice *bus,
|
||||||
/* Indicate that we want to claim the bus */
|
/* Indicate that we want to claim the bus */
|
||||||
ret = dm_gpio_set_value(&priv->ap_claim, 1);
|
ret = dm_gpio_set_value(&priv->ap_claim, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
return ret;
|
||||||
udelay(priv->slew_delay_us);
|
udelay(priv->slew_delay_us);
|
||||||
|
|
||||||
/* Wait for the EC to release it */
|
/* 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) {
|
while (get_timer(start_retry) < priv->wait_retry_ms) {
|
||||||
ret = dm_gpio_get_value(&priv->ec_claim);
|
ret = dm_gpio_get_value(&priv->ec_claim);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto err;
|
return ret;
|
||||||
} else if (!ret) {
|
} else if (!ret) {
|
||||||
/* We got it, so return */
|
/* We got it, so return */
|
||||||
return 0;
|
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 */
|
/* It didn't release, so give up, wait, and try again */
|
||||||
ret = dm_gpio_set_value(&priv->ap_claim, 0);
|
ret = dm_gpio_set_value(&priv->ap_claim, 0);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
return ret;
|
||||||
|
|
||||||
mdelay(priv->wait_retry_ms);
|
mdelay(priv->wait_retry_ms);
|
||||||
} while (get_timer(start) < priv->wait_free_ms);
|
} while (get_timer(start) < priv->wait_free_ms);
|
||||||
|
|
||||||
/* Give up, release our claim */
|
/* Give up, release our claim */
|
||||||
printf("I2C: Could not claim bus, timeout %lu\n", get_timer(start));
|
printf("I2C: Could not claim bus, timeout %lu\n", get_timer(start));
|
||||||
ret = -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
ret = 0;
|
|
||||||
err:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int i2c_arbitrator_probe(struct udevice *dev)
|
static int i2c_arbitrator_probe(struct udevice *dev)
|
||||||
|
|
Loading…
Add table
Reference in a new issue