[U-Boot] [PATCH 3/8] dm: core: remove unnecessary return condition in driver lookup

Masahiro Yamada yamada.m at jp.panasonic.com
Mon Nov 17 09:19:40 CET 2014


The variable "drv" never becomes NULL because ll_entry_start()
always returns a valid pointer even if there are no entries.

The case "n_ents == 0" is covered by the following "for" loop.

Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
---

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

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 0aad56d..0c58ec4 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -25,9 +25,6 @@ struct driver *lists_driver_lookup_name(const char *name)
 	const int n_ents = ll_entry_count(struct driver, driver);
 	struct driver *entry;
 
-	if (!drv || !n_ents)
-		return NULL;
-
 	for (entry = drv; entry != drv + n_ents; entry++) {
 		if (!strcmp(name, entry->name))
 			return entry;
-- 
1.9.1



More information about the U-Boot mailing list