diff options
author | Francois Berder <fberder@outlook.fr> | 2023-09-08 18:47:46 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-09-22 15:54:39 -0400 |
commit | 8cf61051ae6e13e253de0d18501c196bc70522fc (patch) | |
tree | 964377de3602f6ccb5a2c7aa045d7230edfab3ea | |
parent | c5b42e3e9e757ab44da3006e713d8d02b65aa9fe (diff) | |
download | u-boot-8cf61051ae6e13e253de0d18501c196bc70522fc.zip u-boot-8cf61051ae6e13e253de0d18501c196bc70522fc.tar.gz u-boot-8cf61051ae6e13e253de0d18501c196bc70522fc.tar.bz2 |
drivers: mediatek: Fix error handling in mtk_i2c_do_transfer
Errors were handled only if an I2C transfer timed out
and received a NACK which is very unlikely. This commit
changes the condition such that errors are handled if
an I2C transfer times out or received a NACK.
Signed-off-by: Francois Berder <fberder@outlook.fr>
Reviewed-by: Heiko Schocher <hs@denx.de>
-rw-r--r-- | drivers/i2c/mtk_i2c.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/mtk_i2c.c b/drivers/i2c/mtk_i2c.c index 2f331d3..5592fe9 100644 --- a/drivers/i2c/mtk_i2c.c +++ b/drivers/i2c/mtk_i2c.c @@ -621,7 +621,7 @@ static int mtk_i2c_do_transfer(struct mtk_i2c_priv *priv, i2c_writel(priv, REG_INTR_MASK, ~(restart_flag | I2C_HS_NACKERR | I2C_ACKERR | I2C_TRANSAC_COMP)); - if (!tmo && trans_error != 0) { + if (tmo || trans_error != 0) { if (tmo) { ret = -ETIMEDOUT; if (!priv->filter_msg) |