summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-09-28 22:52:27 +0900
committerSimon Glass <sjg@chromium.org>2014-10-22 10:32:16 -0600
commit2cede453dadae5bacd9c659704029bf81e7b06a0 (patch)
tree84f71c4c9320e81c4e062f973090783f4c3bf6e9 /drivers
parent29a1bedbf33d788646b51391bb116e481b9f0b45 (diff)
downloadu-boot-imx-2cede453dadae5bacd9c659704029bf81e7b06a0.zip
u-boot-imx-2cede453dadae5bacd9c659704029bf81e7b06a0.tar.gz
u-boot-imx-2cede453dadae5bacd9c659704029bf81e7b06a0.tar.bz2
dm: simplify the loop in lists_driver_lookup_name()
if (strncmp(name, entry->name, len)) continue; /* Full match */ if (len == strlen(entry->name)) return entry; is equivalent to: if (!strcmp(name, entry->name)) return entry; The latter is simpler. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/lists.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 699f94b..3a1ea85 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -24,19 +24,12 @@ struct driver *lists_driver_lookup_name(const char *name)
ll_entry_start(struct driver, driver);
const int n_ents = ll_entry_count(struct driver, driver);
struct driver *entry;
- int len;
if (!drv || !n_ents)
return NULL;
- len = strlen(name);
-
for (entry = drv; entry != drv + n_ents; entry++) {
- if (strncmp(name, entry->name, len))
- continue;
-
- /* Full match */
- if (len == strlen(entry->name))
+ if (!strcmp(name, entry->name))
return entry;
}