Re: [PATCH] iio: adc: mcp3564: reject devices without match data

From: Andy Shevchenko

Date: Thu Oct 22 2026 - 12:43:04 EST


On Thu, Oct 22, 2026 at 04:24:28AM +0530, Arnav Kapoor wrote:
> The driver identifies the chip by reading its ID registers. If that
> fails, e.g. for a newer part number, it falls back to the match data
> provided by the device tree.
>
> spi_get_device_match_data() returns NULL when the device is bound with
> the "spi: override" property, as in that case no match data is set and
> the device name doesn't match any of the entries of the driver's id
> table.
>
> The driver dereferences the returned pointer without checking it, which
> leads to a NULL pointer dereference and a kernel oops.
>
> Return -ENODATA if no match data is available, like the other IIO SPI
> drivers do.

Fine, but I hope we will have something to land to actually do it differently
for the drivers that don't want to use driver_override mechanism.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Please, shrink the commit message to the point.

--
With Best Regards,
Andy Shevchenko