[U-Boot] [PATCH v2 27/29] dm: Improve errors and warnings in lists_bind_fdt()

Simon Glass sjg at chromium.org
Wed Jul 9 05:38:17 CEST 2014


Add a debug message for when a device tree node has no driver. Also reword
the warning when a device fails to bind, which was misleading.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 drivers/core/lists.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index a8d3aa1..8c0a548 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -123,16 +123,19 @@ int lists_bind_fdt(struct udevice *parent, const void *blob, int offset)
 	const int n_ents = ll_entry_count(struct driver, driver);
 	struct driver *entry;
 	struct udevice *dev;
+	bool found = false;
 	const char *name;
 	int result = 0;
-	int ret;
+	int ret = 0;
 
 	dm_dbg("bind node %s\n", fdt_get_name(blob, offset, NULL));
 	for (entry = driver; entry != driver + n_ents; entry++) {
 		ret = driver_check_compatible(blob, offset, entry->of_match);
+		name = fdt_get_name(blob, offset, NULL);
 		if (ret == -ENOENT) {
 			continue;
 		} else if (ret == -ENODEV) {
+			dm_dbg("Device '%s' has no compatible string\n", name);
 			break;
 		} else if (ret) {
 			dm_warn("Device tree error at offset %d\n", offset);
@@ -141,14 +144,21 @@ int lists_bind_fdt(struct udevice *parent, const void *blob, int offset)
 			break;
 		}
 
-		name = fdt_get_name(blob, offset, NULL);
 		dm_dbg("   - found match at '%s'\n", entry->name);
 		ret = device_bind(parent, entry, name, NULL, offset, &dev);
 		if (ret) {
-			dm_warn("No match for driver '%s'\n", entry->name);
+			dm_warn("Error binding driver '%s'\n", entry->name);
 			if (!result || ret != -ENOENT)
 				result = ret;
+		} else {
+			found = true;
 		}
+		break;
+	}
+
+	if (!found && !result && ret != -ENODEV) {
+		dm_dbg("No match for node '%s'\n",
+		       fdt_get_name(blob, offset, NULL));
 	}
 
 	return result;
-- 
2.0.0.526.g5318336



More information about the U-Boot mailing list