[U-Boot] [PATCH] fsl/usb: fix phy_type checking

Nikhil Badola nikhil.badola at freescale.com
Mon Feb 17 10:09:47 CET 2014


Strcmp should not be used to check the argument of phy_type which maybe parsed
by hwconfig_subarg. Hwconfig_subarg returns part of hwconfig starting from the argument
(if it has the argument) till the end of the string. Since phy_type could be either
'utmi' or 'ulpi', strncmp should be used along with length limited to 4

Signed-off-by: Shaohui Xie <Shaohui.Xie at freescale.com>
Signed-off-by: Nikhil Badola <nikhil.badola at freescale.com>
---
 drivers/usb/host/ehci-fsl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 45e5d6a..1ca7cf5 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -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);
-- 
1.7.11.7




More information about the U-Boot mailing list