Commit d84ace94 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Jonathan Cameron

iio: adc: at91-sama5d2_adc: check return status for pressure and touch

Check return status of at91_adc_read_position() and
at91_adc_read_pressure() in at91_adc_read_info_raw().

Fixes: 6794e23f ("iio: adc: at91-sama5d2_adc: add support for oversampling resolution")
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20220803102855.2191070-3-claudiu.beznea@microchip.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent bb73d5d9
......@@ -1544,8 +1544,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev,
*val = tmp_val;
mutex_unlock(&st->lock);
iio_device_release_direct_mode(indio_dev);
if (ret > 0)
ret = at91_adc_adjust_val_osr(st, val);
return at91_adc_adjust_val_osr(st, val);
return ret;
}
if (chan->type == IIO_PRESSURE) {
ret = iio_device_claim_direct_mode(indio_dev);
......@@ -1558,8 +1560,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev,
*val = tmp_val;
mutex_unlock(&st->lock);
iio_device_release_direct_mode(indio_dev);
if (ret > 0)
ret = at91_adc_adjust_val_osr(st, val);
return at91_adc_adjust_val_osr(st, val);
return ret;
}
/* in this case we have a voltage channel */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment