Skip to content

Commit 57cf4e8

Browse files
Saurav SachidanandAndi Shyti
authored andcommitted
i2c: tegra: fix pm_runtime leak on mutex_lock failure
If tegra_i2c_mutex_lock() fails, the function returns without calling pm_runtime_put(), leaking the runtime PM reference acquired by the preceding pm_runtime_get_sync(). This prevents the device from ever entering runtime suspend. Add the missing pm_runtime_put() before returning on lock failure. Fixes: 6077cfd ("i2c: tegra: Add support for SW mutex register") Signed-off-by: Saurav Sachidanand <sauravsc@amazon.com> Cc: <stable@vger.kernel.org> # v7.0+ Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260507221145.62183-2-sauravsc@amazon.com
1 parent 5d69190 commit 57cf4e8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/i2c/busses/i2c-tegra.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,8 +1666,10 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
16661666
}
16671667

16681668
ret = tegra_i2c_mutex_lock(i2c_dev);
1669-
if (ret)
1669+
if (ret) {
1670+
pm_runtime_put(i2c_dev->dev);
16701671
return ret;
1672+
}
16711673

16721674
for (i = 0; i < num; i++) {
16731675
enum msg_end_type end_type = MSG_END_STOP;

0 commit comments

Comments
 (0)