iio: light: gp2ap002: Fix rumtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Wed, 7 Apr 2021 03:49:27 +0000 (11:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:29:51 +0000 (10:29 +0200)
commit37c7a85a5fb00b75dc25f2b5dd284321abe340ae
tree778afcab7bf17e8d382c5df5283319f2498fe8d8
parentbc0cdd72493236fb72b390ad38ce581e353c143c
iio: light: gp2ap002: Fix rumtime PM imbalance on error

[ Upstream commit 8edb79af88efc6e49e735f9baf61d9f0748b881f ]

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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Fixes: 97d642e23037 ("iio: light: Add a driver for Sharp GP2AP002x00F")
Link: https://lore.kernel.org/r/20210407034927.16882-1-dinghao.liu@zju.edu.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/light/gp2ap002.c