From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fsl/usb: fix phy_type checking
Date: Mon, 17 Feb 2014 10:34:52 +0100 [thread overview]
Message-ID: <20140217103452.1383d2ea@lilith> (raw)
In-Reply-To: <1392628187-30189-1-git-send-email-nikhil.badola@freescale.com>
Hi Nikhil,
On Mon, 17 Feb 2014 14:39:47 +0530, Nikhil Badola
<nikhil.badola@freescale.com> wrote:
> 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
Not sure I understand what exact problem you are considering here. If
you know that phy_type is either "utmi" or "ulpi", then there is no
benefit in switching from strcmp() to strncmp() since there is no risk
that strcmp() overruns any of its arguments.
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> Signed-off-by: Nikhil Badola <nikhil.badola@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);
Amicalement,
--
Albert.
next prev parent reply other threads:[~2014-02-17 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 9:09 [U-Boot] [PATCH] fsl/usb: fix phy_type checking Nikhil Badola
2014-02-17 9:34 ` Albert ARIBAUD [this message]
2014-02-17 10:06 ` nikhil.badola at freescale.com
2014-02-17 10:43 ` Albert ARIBAUD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140217103452.1383d2ea@lilith \
--to=albert.u.boot@aribaud.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.