[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200622020520.5334-1-dinghao.liu@zju.edu.cn>
Date: Mon, 22 Jun 2020 10:05:18 +0800
From: Dinghao Liu <dinghao.liu@....edu.cn>
To: dinghao.liu@....edu.cn, kjlu@....edu
Cc: Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang7@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Wolfram Sang <wsa@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Patrice Chotard <patrice.chotard@...com>,
Scott Branden <scott.branden@...adcom.com>,
Dejin Zheng <zhengdejin5@...il.com>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] i2c: sprd: Fix runtime PM imbalance on error
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@....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
Powered by blists - more mailing lists