]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 30 Jun 2021 06:27:12 +0000 (08:27 +0200)
commit45d8dc102a3267c0d9a0a81c366a9d31d65c1fcf
treebcabe349b8f2a04d2fa7dc8ffba5f035c3d8a60b
parent300e8d35627fec1c3b956e38acc7c42f4f51caa0
iio: adc: ad7124: Fix missbalanced regulator enable / disable on error.

BugLink: https://bugs.launchpad.net/bugs/1931896
commit 4573472315f0fa461330545ff2aa2f6da0b1ae76 upstream.

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: b3af341bbd96 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/iio/adc/ad7124.c