summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorYe Weihua <yeweihua4@huawei.com>2021-04-08 13:06:38 +0200
committerWolfram Sang <wsa@kernel.org>2021-04-14 10:04:23 +0200
commitc4b1fcc310e655fa8414696c38a84d36c00684c8 (patch)
treeda1f332798a1f7b77fc16777c96a716531c9c1f0 /drivers/i2c
parenti2c: xiic: fix reference leak when pm_runtime_get_sync fails (diff)
downloadlinux-c4b1fcc310e655fa8414696c38a84d36c00684c8.tar.xz
linux-c4b1fcc310e655fa8414696c38a84d36c00684c8.zip
i2c: imx: Fix PM reference leak in i2c_imx_reg_slave()
pm_runtime_get_sync() will increment the PM reference count even on failure. Forgetting to put the reference again will result in a leak. Replace it with pm_runtime_resume_and_get() to keep the usage counter balanced. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Ye Weihua <yeweihua4@huawei.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-imx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index dc9c4b4cc25a..dc5ca71906db 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -801,7 +801,7 @@ static int i2c_imx_reg_slave(struct i2c_client *client)
i2c_imx->last_slave_event = I2C_SLAVE_STOP;
/* Resume */
- ret = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
+ ret = pm_runtime_resume_and_get(i2c_imx->adapter.dev.parent);
if (ret < 0) {
dev_err(&i2c_imx->adapter.dev, "failed to resume i2c controller");
return ret;