summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorAlexandru Ardelean <alexandru.ardelean@analog.com>2020-11-27 10:40:38 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-12-03 20:32:19 +0100
commit53c6b0d5d27114a738ac0b312f292aec7f64e9d4 (patch)
tree1984429abc5060f542a3fdcd92113f3351754df3 /drivers/iio/adc
parentiio: adc: ad7298: convert probe to device-managed functions (diff)
downloadlinux-53c6b0d5d27114a738ac0b312f292aec7f64e9d4.tar.xz
linux-53c6b0d5d27114a738ac0b312f292aec7f64e9d4.zip
iio: adc: ad7298: check regulator for null in ad7298_get_ref_voltage()
'st->ext_ref' & 'st->reg' are both non-zero/non-null at the same time, so logically the code isn't broken. But it is more correct to check that 'st->reg' is non-null, since we make sure that the regulator is NULL (in probe) in case one isn't defined. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20201127094038.91714-2-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ad7298.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/ad7298.c b/drivers/iio/adc/ad7298.c
index ecdb01bd5b2f..689ecd5dd563 100644
--- a/drivers/iio/adc/ad7298.c
+++ b/drivers/iio/adc/ad7298.c
@@ -214,7 +214,7 @@ static int ad7298_get_ref_voltage(struct ad7298_state *st)
{
int vref;
- if (st->ext_ref) {
+ if (st->reg) {
vref = regulator_get_voltage(st->reg);
if (vref < 0)
return vref;