aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2019-05-22 07:08:14 +0000
committerTom Rini <trini@konsulko.com>2019-07-12 21:07:59 -0400
commit4213609cc7fb78f84b2ea63f4a5691b60d01c248 (patch)
tree3696e9cd13f388e1b283b7a5097ef548e09ebee9 /drivers/core
parent819ac50d2a7a05eab65b45c1c18fefedbef51e67 (diff)
downloadu-boot-4213609cc7fb78f84b2ea63f4a5691b60d01c248.zip
u-boot-4213609cc7fb78f84b2ea63f4a5691b60d01c248.tar.gz
u-boot-4213609cc7fb78f84b2ea63f4a5691b60d01c248.tar.bz2
drivers: core: use strcmp when find device by name
`if (!strncmp(dev->name, name, strlen(name)))` might find out the wrong device, it might find out `dram_pll_ref_sel`, when name is `dram_pll`. So use strcmp to avoid such issue. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index dc9eb62..b332965 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -260,7 +260,7 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
return ret;
uclass_foreach_dev(dev, uc) {
- if (!strncmp(dev->name, name, strlen(name))) {
+ if (!strcmp(dev->name, name)) {
*devp = dev;
return 0;
}