dm: core: remove unnecessary return condition in driver lookup
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Mon, 17 Nov 2014 08:19:40 +0000 (17:19 +0900)
committerSimon Glass <sjg@chromium.org>
Sat, 22 Nov 2014 09:16:49 +0000 (10:16 +0100)
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@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/core/lists.c

index 3a1823db0205498fb8a42c4ffa75bc77d1c02770..058f2780a3732a8c661359a9bbf0a03691be05f7 100644 (file)
@@ -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;