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:08:47 +0000 (11:08 -0800)
commit57629351f0a627101ac85419bb7b25c4af743809
tree2788ea4a26ab18966dd1439b6fdc866a63ed8457
parent1e36467f654e694c4c3421fa437a3bd28088adca
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