Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Alexandru Ardelean and committed by
Jonathan Cameron
53c6b0d5 b6a3f832

+1 -1
+1 -1
drivers/iio/adc/ad7298.c
··· 214 214 { 215 215 int vref; 216 216 217 - if (st->ext_ref) { 217 + if (st->reg) { 218 218 vref = regulator_get_voltage(st->reg); 219 219 if (vref < 0) 220 220 return vref;