Re: RE: Re:RE: [PATCH] pinctrl: mcp23s08: reject devices without match data

From: Linus Walleij

Date: Thu Oct 01 2026 - 16:07:55 EST


On Mon, Sep 28, 2026 at 9:25 AM jiale yao <19888972804@xxxxxxx> wrote:

> I reproduced this deterministically with KASAN on arm64 QEMU.
> The SPI device has an unmatched compatible and a valid microchip,spi-present-mask property, and is then bound with:
>
> echo mcp23s08 > /sys/bus/spi/devices/spi0.0/driver_override
> echo spi0.0 > /sys/bus/spi/drivers/mcp23s08/bind

[KASAN splat from spi_get_device_match_data() returning NULL]

But hey look in the driver:

static const struct spi_device_id mcp23s08_ids[] = {
{ "mcp23s08", (kernel_ulong_t)&mcp23s08_spi },
{ "mcp23s17", (kernel_ulong_t)&mcp23s17_spi },
{ "mcp23s18", (kernel_ulong_t)&mcp23s18_spi },
{ }
};
MODULE_DEVICE_TABLE(spi, mcp23s08_ids);

Why doesn't the override find the right data from the match table?

This looks more like a bug in the SPI bus implementation,
surely the bus should match a driver_overrid and return a
valid match data from spi_get_device_match_data()?

I think this is just papering over the real issue, you need
to dig into the SPI bus implementation and see why this isn't
working.

Yours,
Linus Walleij