From: Peng Fan Date: Wed, 22 May 2019 07:08:14 +0000 (+0000) Subject: drivers: core: use strcmp when find device by name X-Git-Tag: v2019.10-rc1~31^2~21 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4213609cc7fb78f84b2ea63f4a5691b60d01c248;p=oweals%2Fu-boot.git 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 Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index dc9eb62893..b33296542f 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; }