mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
iio: adc: ad4695: simplify getting oversampling_ratio
We already have a local variable that holds a pointer to st->channels_cfg[chan->scan_index]. Use that to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250218-iio-adc-ad4695-fix-out-of-bounds-array-access-v1-2-57fef8c7a3fd@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
cafeb8a997
commit
38f898e0b5
@@ -1175,7 +1175,7 @@ static int ad4695_read_raw(struct iio_dev *indio_dev,
|
||||
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
|
||||
switch (chan->type) {
|
||||
case IIO_VOLTAGE:
|
||||
*val = st->channels_cfg[chan->scan_index].oversampling_ratio;
|
||||
*val = cfg->oversampling_ratio;
|
||||
return IIO_VAL_INT;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user