mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
i2c: spacemit: ensure bus release check runs when wait_bus_idle() fails
spacemit_i2c_wait_bus_idle() only returns 0 on success or a negative
error code on failure.
Since 'ret' can never be positive, the final 'else' branch was
unreachable, and spacemit_i2c_check_bus_release() was never called.
This commit guarantees we attempt to release the bus whenever waiting for
an idle bus fails.
Fixes: 5ea558473f ("i2c: spacemit: add support for SpacemiT K1 SoC")
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
This commit is contained in:
parent
b492183652
commit
41d6f90ef5
|
|
@ -476,12 +476,13 @@ static int spacemit_i2c_xfer(struct i2c_adapter *adapt, struct i2c_msg *msgs, in
|
|||
spacemit_i2c_enable(i2c);
|
||||
|
||||
ret = spacemit_i2c_wait_bus_idle(i2c);
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
ret = spacemit_i2c_xfer_msg(i2c);
|
||||
else if (ret < 0)
|
||||
dev_dbg(i2c->dev, "i2c transfer error: %d\n", ret);
|
||||
else
|
||||
if (ret < 0)
|
||||
dev_dbg(i2c->dev, "i2c transfer error: %d\n", ret);
|
||||
} else {
|
||||
spacemit_i2c_check_bus_release(i2c);
|
||||
}
|
||||
|
||||
spacemit_i2c_disable(i2c);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user