]> git.baikalelectronics.ru Git - kernel.git/commit
iio: ad7292: Prevent regulator double disable
authorMatti Vaittinen <mazziesaccount@gmail.com>
Fri, 19 Aug 2022 08:51:07 +0000 (11:51 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 21 Aug 2022 17:24:16 +0000 (18:24 +0100)
commit3f271be098878f123a7170807dc752c43c457356
tree6d8b3a95ff7a6fe6ade0e848c25238a31534b14f
parentcd7834ba2f4b789f3fe0f141eba896fb31659d90
iio: ad7292: Prevent regulator double disable

The ad7292 tries to add an devm_action for disabling a regulator at
device detach using devm_add_action_or_reset(). The
devm_add_action_or_reset() does call the release function should adding
action fail. The driver inspects the value returned by
devm_add_action_or_reset() and manually calls regulator_disable() if
adding the action has failed. This leads to double disable and messes
the enable count for regulator.

Do not manually call disable if devm_add_action_or_reset() fails.

Fixes: 76f540e22be6 ("iio: adc: Add driver support for AD7292")
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Tested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/Yv9O+9sxU7gAv3vM@fedora
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7292.c