Skip to contentSkip to conversation

drivers: core: use strcmp when find device by name

PATCH New Peng Fan 2 participants 5 messages Apr 28, 2019 – May 22, 2019

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/uclass.c +1 -1
index fc3157de39..e2f35393a9 100644
@@ -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;
 		}
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/1 drivers: core: use strcmp when find device by name

Quoted 9 lines · Peng Fan

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.

---
 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This seems to match the function description in the header file, too.

author
#2 lore raw

PATCH 1/1 drivers: core: use strcmp when find device by name

Hi Simon,

Quoted 8 lines

Subject: Re: [PATCH] drivers: core: use strcmp when find device by name

Quoted 5 lines · Peng Fan

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.

Quoted 8 lines
Quoted 4 lines
---
 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This seems to match the function description in the header file, too.

Will you pick up this patch? Not see this patch in your tree.

Thanks,
Peng.

#3 lore raw

PATCH 1/1 drivers: core: use strcmp when find device by name

Hi Peng,

Quoted 16 lines · Peng Fan

Hi Simon,

Quoted 13 lines

Subject: Re: [PATCH] drivers: core: use strcmp when find device by name

Quoted 9 lines · Peng Fan

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.

---
 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Quoted 3 lines

This seems to match the function description in the header file, too.

Will you pick up this patch? Not see this patch in your tree.

I found that this causes a test failure - can you try 'make qcheck' and see if you can figure out what is going on?

Regards,
Simon

author
#4 lore raw

PATCH 1/1 drivers: core: use strcmp when find device by name

Hi Simon,

Quoted 22 lines

Subject: Re: [PATCH] drivers: core: use strcmp when find device by name

Hi Peng,

Quoted 17 lines · Peng Fan

Hi Simon,

Quoted 14 lines

Subject: Re: [PATCH] drivers: core: use strcmp when find device by name

Quoted 9 lines · Peng Fan

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.

---
 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

This seems to match the function description in the header file, too.

Will you pick up this patch? Not see this patch in your tree.

I found that this causes a test failure - can you try 'make qcheck' and see if you can figure out what is going on?

With this patch applied. Test/dm/adc.c and usb.c needs some change to use real device name. I just posted out new patchset including this one.

Pease review.

Thanks,
Peng

Quoted 3 lines

Regards,
Simon