]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iio: adc: ad7124: fix channel lookup in syscalib functions
authorDavid Lechner <dlechner@baylibre.com>
Sat, 26 Jul 2025 16:28:48 +0000 (11:28 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 11 Aug 2025 20:35:01 +0000 (21:35 +0100)
commit197e299aae42ffa19028eaea92b2f30dd9fb8445
treec4e24861d3f034c6f46f9d132f429f6228e193e8
parentae5bc07ec9f73a41734270ef3f800c5c8a7e0ad3
iio: adc: ad7124: fix channel lookup in syscalib functions

Fix possible incorrect channel lookup in the syscalib functions by using
the correct channel address instead of the channel number.

In the ad7124 driver, the channel field of struct iio_chan_spec is the
input pin number of the positive input of the channel. This can be, but
is not always the same as the index in the channels array. The correct
index in the channels array is stored in the address field (and also
scan_index). We use the address field to perform the correct lookup.

Fixes: 47036a03a303 ("iio: adc: ad7124: Implement internal calibration at probe time")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250726-iio-adc-ad7124-fix-channel-lookup-in-syscalib-v1-1-b9d14bb684af@baylibre.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7124.c