[PATCH 2/8] driver: Don't throw an error on probes that didn't find the device

Ahmad Fatoum ahmad at a3f.at
Mon Feb 22 02:05:58 EST 2021


As the name suggests, determining that a device doesn't match is a valid
thing for probe to do. Unlike Linux, we throw an error in that case.
This will becomes annoying if we start probing virtio-mmio devices,
because Qemu registers a bunch and only assigns functions on demand.
Thus don't print an error message for ENXIO and ENODEV like Linux does.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/base/driver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 6763bbc6f512..f60533c59eb1 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -102,7 +102,10 @@ int device_probe(struct device_d *dev)
 	list_del(&dev->active);
 	INIT_LIST_HEAD(&dev->active);
 
-	dev_err(dev, "probe failed: %s\n", strerror(-ret));
+	if (ret == -ENODEV || ret == -ENXIO)
+		dev_dbg(dev, "probe failed: %s\n", strerror(-ret));
+	else
+		dev_err(dev, "probe failed: %s\n", strerror(-ret));
 
 	return ret;
 }
-- 
2.30.0




More information about the barebox mailing list