diff options
author | Sang-Hun Lee <sanlee@nvidia.com> | 2014-05-19 17:12:30 -0700 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2014-05-23 12:46:35 -0700 |
commit | c4f8ec27a48d95aaffc02984ed4fdf24a17869f2 (patch) | |
tree | b2abb43a8e0ab8cf4f8cee6f30603501503fca31 | |
parent | b718b347c03acf8737ec21fcad62296b1423bc1c (diff) |
i2c: tegra: warn on i2c init failure
- If tegra_i2c_init fails during xfer, the error is being
silently ignored, making the debug difficult
- If tegra_i2c_init fails, at least print a warning and
stack trace to make the failure explicit
Bug 1510778
Change-Id: Id885b3ad64f1f26304fa6d6cdb5c5ec8e682c038
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/411721
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 66aabc0e3666..4081496bec24 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1124,8 +1124,12 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, "i2c transfer timed out, addr 0x%04x, data 0x%02x\n", msg->addr, msg->buf[0]); - tegra_i2c_init(i2c_dev); - return -ETIMEDOUT; + ret = tegra_i2c_init(i2c_dev); + if (!ret) + ret = -ETIMEDOUT; + else + WARN_ON(1); + return ret; } dev_dbg(i2c_dev->dev, "transfer complete: %d %d %d\n", @@ -1169,7 +1173,11 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, if (i2c_dev->msg_err == I2C_ERR_NO_ACK) udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); - tegra_i2c_init(i2c_dev); + ret = tegra_i2c_init(i2c_dev); + if (ret) { + WARN_ON(1); + return ret; + } /* Arbitration Lost occurs, Start recovery */ if (i2c_dev->msg_err == I2C_ERR_ARBITRATION_LOST) { |