[PATCH 1/6] driver: make struct bus_type::match optional
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Feb 28 08:05:13 PST 2024
Newly introduce soc_bus_type doesn't define .match, which would crash
once a driver is registered on that bus. Do as Linux does and treat a
non-existent match callback as meaning that all drivers should be
matched and that the probe function should indicate via -ENODEV/-ENXIO
whether a device is indeed suitable.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/base/driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3fac9c59f677..babc08f8b6b2 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -221,7 +221,7 @@ static int match(struct driver *drv, struct device *dev)
dev->driver = drv;
- if (dev->bus->match(dev, drv))
+ if (dev->bus->match && dev->bus->match(dev, drv))
goto err_out;
ret = device_probe(dev);
if (ret)
--
2.39.2
More information about the barebox
mailing list