Skip to content

Commit 8edb79a

Browse files
dinghaoliujic23
authored andcommitted
iio: light: gp2ap002: Fix rumtime PM imbalance on error
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 <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Fixes: 97d642e ("iio: light: Add a driver for Sharp GP2AP002x00F") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 6efb943 commit 8edb79a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/iio/light/gp2ap002.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ static int gp2ap002_probe(struct i2c_client *client,
582582
"gp2ap002", indio_dev);
583583
if (ret) {
584584
dev_err(dev, "unable to request IRQ\n");
585-
goto out_disable_vio;
585+
goto out_put_pm;
586586
}
587587
gp2ap002->irq = client->irq;
588588

@@ -612,8 +612,9 @@ static int gp2ap002_probe(struct i2c_client *client,
612612

613613
return 0;
614614

615-
out_disable_pm:
615+
out_put_pm:
616616
pm_runtime_put_noidle(dev);
617+
out_disable_pm:
617618
pm_runtime_disable(dev);
618619
out_disable_vio:
619620
regulator_disable(gp2ap002->vio);

0 commit comments

Comments
 (0)