All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: stm32f7: Fix runtime PM imbalance in stm32f7_i2c_unreg_slave
@ 2020-05-21  7:08 ` Dinghao Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Dinghao Liu @ 2020-05-21  7:08 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Pierre-Yves MORDRET, Maxime Coquelin, Alexandre Torgue,
	linux-i2c, linux-stm32, linux-arm-kernel, linux-kernel

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

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/i2c/busses/i2c-stm32f7.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 330ffed011e0..6f5f0fa68385 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -1837,8 +1837,10 @@ static int stm32f7_i2c_unreg_slave(struct i2c_client *slave)
 	WARN_ON(!i2c_dev->slave[id]);
 
 	ret = pm_runtime_get_sync(i2c_dev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_autosuspend(i2c_dev->dev);
 		return ret;
+	}
 
 	if (id == 0) {
 		mask = STM32F7_I2C_OAR1_OA1EN;
-- 
2.17.1


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

* [PATCH] i2c: stm32f7: Fix runtime PM imbalance in stm32f7_i2c_unreg_slave
@ 2020-05-21  7:08 ` Dinghao Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Dinghao Liu @ 2020-05-21  7:08 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Alexandre Torgue, linux-kernel, Pierre-Yves MORDRET, linux-i2c,
	Maxime Coquelin, linux-stm32, linux-arm-kernel

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

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/i2c/busses/i2c-stm32f7.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 330ffed011e0..6f5f0fa68385 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -1837,8 +1837,10 @@ static int stm32f7_i2c_unreg_slave(struct i2c_client *slave)
 	WARN_ON(!i2c_dev->slave[id]);
 
 	ret = pm_runtime_get_sync(i2c_dev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_autosuspend(i2c_dev->dev);
 		return ret;
+	}
 
 	if (id == 0) {
 		mask = STM32F7_I2C_OAR1_OA1EN;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-05-21  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21  7:08 [PATCH] i2c: stm32f7: Fix runtime PM imbalance in stm32f7_i2c_unreg_slave Dinghao Liu
2020-05-21  7:08 ` Dinghao Liu

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.