All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: sprd: Fix runtime PM imbalance on error
@ 2020-06-22  2:05 Dinghao Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Dinghao Liu @ 2020-06-22  2:05 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Orson Zhai, Baolin Wang, Chunyan Zhang, Wolfram Sang,
	Andy Shevchenko, Patrice Chotard, Scott Branden, Dejin Zheng,
	linux-i2c, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter even
the call returns an error code. Thus a corresponding decrement is
needed on the error handling path to keep the counter balanced.

Fix this by adding the missed function call.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/i2c/busses/i2c-sprd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c
index 19cda6742423..675f72a3fd60 100644
--- a/drivers/i2c/busses/i2c-sprd.c
+++ b/drivers/i2c/busses/i2c-sprd.c
@@ -285,8 +285,10 @@ static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap,
 	int im, ret;
 
 	ret = pm_runtime_get_sync(i2c_dev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_noidle(i2c_dev->dev);
 		return ret;
+	}
 
 	for (im = 0; im < num - 1; im++) {
 		ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im], 0);
@@ -571,8 +573,10 @@ static int sprd_i2c_remove(struct platform_device *pdev)
 	int ret;
 
 	ret = pm_runtime_get_sync(i2c_dev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_noidle(i2c_dev->dev);
 		return ret;
+	}
 
 	i2c_del_adapter(&i2c_dev->adap);
 	clk_disable_unprepare(i2c_dev->clk);
-- 
2.17.1


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

* Re: [PATCH] i2c: sprd: Fix runtime PM imbalance on error
@ 2020-06-22 18:15 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-06-22 18:15 UTC (permalink / raw)
  To: Dinghao Liu, linux-i2c
  Cc: Aditya Pakki, Navid Emamdoost, Kangjie Lu, Qiushi Wu,
	linux-kernel, Wolfram Sang, Chunyan Zhang, Dejin Zheng,
	Scott Branden, Patrice Chotard, Orson Zhai, Baolin Wang,
	Andy Shevchenko

> Fix this by …

Please replace the beginning of this sentence with the tag “Fixes”.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=625d3449788f85569096780592549d0340e9c0c7#n183

Regards,
Markus

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

end of thread, other threads:[~2020-06-22 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22  2:05 [PATCH] i2c: sprd: Fix runtime PM imbalance on error Dinghao Liu
2020-06-22 18:15 Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.