iio: adc: stm32: fix vrefint wrong calibration value handling
authorOlivier Moysan <olivier.moysan@foss.st.com>
Thu, 9 Jun 2022 09:58:56 +0000 (11:58 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Jun 2022 16:22:49 +0000 (17:22 +0100)
commitbc05f30fc24705cd023f38659303376eaa5767df
tree05d966ff2b61928bb5f9fc41c48c3f07e7b172a5
parent106b391e1b859100a3f38f0ad874236e9be06bde
iio: adc: stm32: fix vrefint wrong calibration value handling

If the vrefint calibration is zero, the vrefint channel output value
cannot be computed. Currently, in such case, the raw conversion value
is returned, which is not relevant.
Do not expose the vrefint channel when the output value cannot be
computed, instead.

Fixes: 0e346b2cfa85 ("iio: adc: stm32-adc: add vrefint calibration support")
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220609095856.376961-1-olivier.moysan@foss.st.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/stm32-adc.c