[PATCH 1/6] driver: make struct bus_type::match optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux