mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: mcp23s08: reject devices without match data
@ 2026-09-25 13:38 Jiale Yao
  2026-09-26 10:07 ` Biju Das
  0 siblings, 1 reply; 9+ messages in thread
From: Jiale Yao @ 2026-09-25 13:38 UTC (permalink / raw)
  To: Linus Walleij, Biju Das, Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Jiale Yao

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.

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@163.com>
---
 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-28  8:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:38 [PATCH] pinctrl: mcp23s08: reject devices without match data Jiale Yao
2026-09-26 10:07 ` Biju Das
2026-09-26 10:23   ` jiale yao
2026-09-26 10:28     ` jiale yao
2026-09-28  6:03     ` Biju Das
2026-09-28  7:24       ` jiale yao
2026-09-28  7:32         ` Biju Das
2026-09-28  7:54           ` jiale yao
2026-09-28  8:05             ` Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®