fsl/usb: Limit phy_type comparison to first four characters
authorNikhil Badola <nikhil.badola@freescale.com>
Mon, 17 Feb 2014 11:28:36 +0000 (16:58 +0530)
committerYork Sun <yorksun@freescale.com>
Mon, 24 Feb 2014 23:23:57 +0000 (15:23 -0800)
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.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
drivers/usb/host/ehci-fsl.c

index 45e5d6a5bde7b458638edfc2992620b7fd3a33ef..1ca7cf5d9b7911aac8e2bbc5c5ff7aefffe2e299 100644 (file)
@@ -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);