iio: adc: imx8qxp-adc: propagate regulator_get_voltage error
authorMartin Larsson <martin.larsson@actia.se>
Wed, 20 Jul 2022 15:31:54 +0000 (15:31 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 15 Aug 2022 21:29:57 +0000 (22:29 +0100)
commitbd1d558c9c65cf56623a3a237a2998697586c409
treebd3effdaabce1a5ee57ea68b7bd26345f85df031
parent9e8284501c8d9e2bde4dfcddaf0201ee7cc8f2a7
iio: adc: imx8qxp-adc: propagate regulator_get_voltage error

If the ADC vref regulator returns an error, for example, if CONFIG_REGULATOR
is not set, the error will be used as a reference voltage.

Introduce a guard for negative return values instead of unconditionally
casting it to u32.

Acked-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Martin Larsson <martin.larsson@actia.se>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20220720153136.3502440-1-martin.larsson@actia.se
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/imx8qxp-adc.c