public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: light: gp2ap002: Fix rumtime PM imbalance on error
@ 2021-04-07  3:49 Dinghao Liu
  2021-04-07  7:16 ` Linus Walleij
  2021-04-11 15:07 ` Jonathan Cameron
  0 siblings, 2 replies; 8+ messages in thread
From: Dinghao Liu @ 2021-04-07  3:49 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

When devm_request_threaded_irq() fails, we should decrease the
runtime PM counter to keep the counter balanced. But when
iio_device_register() fails, we need not to decrease it because
we have already decreased it before.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/iio/light/gp2ap002.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c
index 7ba7aa59437c..040d8429a6e0 100644
--- a/drivers/iio/light/gp2ap002.c
+++ b/drivers/iio/light/gp2ap002.c
@@ -583,7 +583,7 @@ static int gp2ap002_probe(struct i2c_client *client,
 					"gp2ap002", indio_dev);
 	if (ret) {
 		dev_err(dev, "unable to request IRQ\n");
-		goto out_disable_vio;
+		goto out_put_pm;
 	}
 	gp2ap002->irq = client->irq;
 
@@ -613,8 +613,9 @@ static int gp2ap002_probe(struct i2c_client *client,
 
 	return 0;
 
-out_disable_pm:
+out_put_pm:
 	pm_runtime_put_noidle(dev);
+out_disable_pm:
 	pm_runtime_disable(dev);
 out_disable_vio:
 	regulator_disable(gp2ap002->vio);
-- 
2.17.1


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

end of thread, other threads:[~2021-04-19 10:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-07  3:49 [PATCH] iio: light: gp2ap002: Fix rumtime PM imbalance on error Dinghao Liu
2021-04-07  7:16 ` Linus Walleij
2021-04-11 15:07 ` Jonathan Cameron
2021-04-11 22:38   ` Linus Walleij
2021-04-12 10:15     ` Jonathan Cameron
2021-04-12 11:47       ` Linus Walleij
2021-04-18  9:43         ` Jonathan Cameron
2021-04-19 10:28           ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox