Re: [PATCH 0/9] iio: adc: reject SPI devices without match data

From: Jonathan Cameron

Date: Sun Sep 27 2026 - 13:51:26 EST


On Fri, 25 Sep 2026 20:57:38 +0800
Jiale Yao <yaojiale02@xxxxxxx> wrote:

> SPI driver_override can bind a device to a driver without a matching
> firmware entry or SPI device ID. In that case,
> spi_get_device_match_data() returns NULL.
>
> These nine ADC probe paths assume that the returned chip information is
> present and later dereference it. Reject devices without match data before
> the pointer is used, following the handling added to the AD5686 bus
> frontends by commit 572a00852635 ("iio: dac: ad5686: missing NULL check on
> match data").
>
> The ADC128S052 and ADS7950 probes also dereference spi_get_device_id() to
> obtain the IIO device name. Use the always available SPI modalias instead,
> so the override path does not depend on a matching SPI ID.
>
> Each patch fixes one driver and can be applied independently.

Whilst I'd have loved to just set the flag that the series Uwe
links to adds, that's not available yet so for now indeed
these are all valid fixes. I'm not going to rush them in.
Applied to the testing branch of iio.git which means next merge
window most likely.

Thanks,

Jonathan

>
> Jiale Yao (9):
> iio: adc: ad7192: reject devices without match data
> iio: adc: ad7606: reject devices without match data
> iio: adc: ad7768-1: reject devices without match data
> iio: adc: max11205: reject devices without match data
> iio: adc: mcp3911: reject devices without match data
> iio: adc: ti-adc128s052: validate SPI match data
> iio: adc: ti-ads1018: reject devices without match data
> iio: adc: ti-ads131m02: reject devices without match data
> iio: adc: ti-ads7950: validate SPI match data
>
> drivers/iio/adc/ad7192.c | 3 +++
> drivers/iio/adc/ad7606_spi.c | 6 +++++-
> drivers/iio/adc/ad7768-1.c | 3 +++
> drivers/iio/adc/max11205.c | 2 ++
> drivers/iio/adc/mcp3911.c | 2 ++
> drivers/iio/adc/ti-adc128s052.c | 8 +++++---
> drivers/iio/adc/ti-ads1018.c | 3 +++
> drivers/iio/adc/ti-ads131m02.c | 2 ++
> drivers/iio/adc/ti-ads7950.c | 4 +++-
> 9 files changed, 28 insertions(+), 5 deletions(-)
>
> base-commit: 93f51579e7df248780214094418f205253383cc5