Linux-i2c Archive on
 help / color / Atom feed
* [PATCH -next] i2c: imx-lpi2c: fix PM reference leak in lpi2c_imx_master_enable()
@ 2021-04-08 11:19 Ye Weihua
  2021-04-14  7:56 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Ye Weihua @ 2021-04-08 11:19 UTC (permalink / raw)
  To: aisheng.dong, shawnguo, s.hauer, kernel, festevam, linux-imx
  Cc: linux-i2c, linux-arm-kernel, linux-kernel, yangjihong1, zhangjinhao2

The PM reference count is not expected to be incremented on return in

However, 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

Reported-by: Hulk Robot <>
Signed-off-by: Ye Weihua <>
 drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index 9db6ccded5e9..8b9ba055c418 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -259,7 +259,7 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx)
 	unsigned int temp;
 	int ret;
-	ret = pm_runtime_get_sync(lpi2c_imx->;
+	ret = pm_runtime_resume_and_get(lpi2c_imx->;
 	if (ret < 0)
 		return ret;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 11:19 [PATCH -next] i2c: imx-lpi2c: fix PM reference leak in lpi2c_imx_master_enable() Ye Weihua
2021-04-14  7:56 ` Wolfram Sang

Linux-i2c Archive on

Archives are clonable:
	git clone --mirror linux-i2c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i2c linux-i2c/ \
	public-inbox-index linux-i2c

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone