]> git.baikalelectronics.ru Git - kernel.git/commit
iio: adc: ad7124: Fix missbalanced regulator enable / disable on error.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 13 May 2021 12:07:41 +0000 (15:07 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 13 May 2021 15:32:39 +0000 (16:32 +0100)
commit18af678ff12c307130b77ff39fa1c8da2c9cbb0e
tree4bc81d2c30a1869ba3c1c6202c78089df4be3dff
parent4ceb7b5db4dd2cd24c6d595d5d2e5fc60279459c
iio: adc: ad7124: Fix missbalanced regulator enable / disable on error.

If the devm_regulator_get() call succeeded but not the regulator_enable()
then regulator_disable() would be called on a regulator that was not
enabled.

Fix this by moving regulator enabling / disabling over to
devm_ management via devm_add_action_or_reset.

Alexandru's sign-off here because he pulled Jonathan's patch into
a larger set which Jonathan then applied.

Fixes: dee1201254fe ("iio: adc: Add ad7124 support")
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Cc: <Stable@vger.kernel.org>
drivers/iio/adc/ad7124.c