Skip to contentSkip to conversation

fsl/usb: Limit phy_type comparison to first four characters

PATCH New Nikhil Badola 2 participants 2 messages Feb 17, 2014 – Feb 24, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fsl/usb: Limit phy_type comparison to first four characters

Use first four characters for phy_type comparison. Strcmp() should not be used to check the phy_type string which maybe parsed by hwconfig_subarg(). Hwconfig_subarg() returns part of hwconfig string starting from phy_type value till the end of the string. Since phy_type could be either "utmi" or "ulpi", strncmp() should be used so that a comparison of "utmi;fsl_ddr:bank_intlv=auto" with "utmi" will succeed.

---
Changes for v2:
- Changed patch heading
- Changed patch commit message

 drivers/usb/host/ehci-fsl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-fsl.c +1 -1
index 45e5d6a..1ca7cf5 100644
@@ -86,7 +86,7 @@ int ehci_hcd_init(int index, enum usb_init_type init,
 #endif
 	}
 
-	if (!strcmp(phy_type, "utmi")) {
+	if (!strncmp(phy_type, "utmi", 4)) {
 #if defined(CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY)
 		setbits_be32(&ehci->control, PHY_CLK_SEL_UTMI);
 		setbits_be32(&ehci->control, UTMI_PHY_EN);
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH v2 1/1 fsl/usb: Limit phy_type comparison to first four characters

Quoted 7 lines · Nikhil Badola

Use first four characters for phy_type comparison. Strcmp() should not be used to check the phy_type string which maybe parsed by hwconfig_subarg(). Hwconfig_subarg() returns part of hwconfig string starting from phy_type value till the end of the string. Since phy_type could be either "utmi" or "ulpi", strncmp() should be used so that a comparison of "utmi;fsl_ddr:bank_intlv=auto" with "utmi" will succeed.

Quoted 7 lines

---
Changes for v2:
- Changed patch heading
- Changed patch commit message

Applied to u-boot-mpc85xx/master. Thanks.

York