iio: frequency: admv1013: propagate errors from regulator_get_voltage()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 18 Jul 2023 07:02:18 +0000 (10:02 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Aug 2023 16:27:24 +0000 (18:27 +0200)
commit5e1ed816a0e1dd71025a8484dfefebf792fcafee
tree7fa0f69617d33214dc9445e65d4707d0a3a3490d
parent366563c14f1f8871fcf590d23e2f645fc81340d9
iio: frequency: admv1013: propagate errors from regulator_get_voltage()

commit 507397d19b5a296aa339f7a1bd16284f668a1906 upstream.

The regulator_get_voltage() function returns negative error codes.
This function saves it to an unsigned int and then does some range
checking and, since the error code falls outside the correct range,
it returns -EINVAL.

Beyond the messiness, this is bad because the regulator_get_voltage()
function can return -EPROBE_DEFER and it's important to propagate that
back properly so it can be handled.

Fixes: da35a7b526d9 ("iio: frequency: admv1013: add support for ADMV1013")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/ce75aac3-2aba-4435-8419-02e59fdd862b@moroto.mountain
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/frequency/admv1013.c