iio: ad5064: Fix regulator handling

commit 8911a43bc1 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>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
[bwh: Backported to 3.16: Keep using ad5064_write() instead of
 ad5064_set_config().]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
Lars-Peter Clausen 2018-09-28 11:23:40 +02:00 • committed by Ben Hutchings
commit f9dbd14631