iio: ad5064: Fix regulator handling
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 28 Sep 2018 09:23:40 +0000 (11:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:15:08 +0000 (11:15 -0800)
commit8b38d82b0d278d5725e02e470f3cdd46423ba7b1
tree48a87f738778bc52b6eb7cdc873187b3bbc48f18
parentd6ea9f3055378e7e520264025b6cc63c88615577
iio: ad5064: Fix regulator handling

commit 8911a43bc198877fad9f4b0246a866b26bb547ab upstream.

The correct way to handle errors returned by regualtor_get() and friends is
to propagate the error since that means that an regulator was specified,
but something went wrong when requesting it.

For handling optional regulators, e.g. when the device has an internal
vref, regulator_get_optional() should be used to avoid getting the dummy
regulator that the regulator core otherwise provides.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/dac/ad5064.c