]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
drivers: core: use strcmp when find device by name
authorPeng Fan <peng.fan@nxp.com>
Wed, 22 May 2019 07:08:14 +0000 (07:08 +0000)
committerTom Rini <trini@konsulko.com>
Sat, 13 Jul 2019 01:07:59 +0000 (21:07 -0400)
`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>
drivers/core/uclass.c

index dc9eb62893e0d2d84283aa39d8c6bffd4868b201..b33296542f63ddfed35739ea891483b03d5504e6 100644 (file)
@@ -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;
                }