RE: [PATCH] pinctrl: mcp23s08: reject devices without match data
From: Biju Das
Date: Sat Sep 26 2026 - 06:07:51 EST
Hi,
> -----Original Message-----
> From: Jiale Yao <yaojiale02@xxxxxxx>
> Sent: 25 September 2026 14:38
> Subject: [PATCH] pinctrl: mcp23s08: reject devices without match data
>
> A device bound through driver_override need not match an entry in the driver tables. In that case
> spi_get_device_match_data() returns NULL, but mcp23s08_probe() later passes the result to the regmap
> setup and dereferences it while setting up each device.
I believe this is an invalid use case as the user trying driver_override
and the probe returns error. Am I missing anything here?
Can you please prepare a patch that makes the driver probe success by using driver_override
Feature? Also please share some logs to see how it works in real device
Cheers,
Biju
>
> Reject devices without match data before reading device properties.
>
> Fixes: 2e44555b05c0 ("pinctrl: mcp23s08: Simplify probe()/mcp23s08_spi_regmap_init()")
> Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
> ---
> drivers/pinctrl/pinctrl-mcp23s08_spi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-mcp23s08_spi.c b/drivers/pinctrl/pinctrl-mcp23s08_spi.c
> index bacebcff67ef..926034fcd512 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08_spi.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08_spi.c
> @@ -146,6 +146,8 @@ static int mcp23s08_probe(struct spi_device *spi)
> u8 v;
>
> info = spi_get_device_match_data(spi);
> + if (!info)
> + return -ENODATA;
>
> ret = device_property_read_u8(dev, "microchip,spi-present-mask", &v);
> if (ret) {
> --
> 2.34.1