[PATCH] mfd: mc13xxx-spi: Reject devices without match data

From: Jiale Yao

Date: Fri Sep 25 2026 - 09:38:41 EST


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 mc13xxx_common_init() later uses the missing variant data.

Reject devices without match data before entering the common probe path.

Fixes: 15d71e678ec1 ("mfd: mc13xxx-spi/wm831x-spi: Use spi_get_device_match_data()")
Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
---
drivers/mfd/mc13xxx-spi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 56d2e57b7d73..d1523321152a 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -150,6 +150,8 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
}

mc13xxx->variant = spi_get_device_match_data(spi);
+ if (!mc13xxx->variant)
+ return -ENODATA;

return mc13xxx_common_init(&spi->dev);
}
--
2.34.1