Skip to content

Commit

Permalink
iio: light: gp2ap002: Fix rumtime PM imbalance on error
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dinghaoliu authored and jic23 committed May 10, 2021
1 parent 6efb943 commit 8edb79a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/iio/light/gp2ap002.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,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;

Expand Down Expand Up @@ -612,8 +612,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);
Expand Down

0 comments on commit 8edb79a

Please sign in to comment.