Skip to content

Commit

Permalink
[POWERPC] Fix potential NULL dereference
Browse files Browse the repository at this point in the history
This patch does fix potential NULL pointer dereference that could take
place inside of strcmp() if of_get_property() call failed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
  • Loading branch information
Cyrill Gorcunov authored and Kumar Gala committed Nov 20, 2007
1 parent 2ffbb83 commit 7ac3341
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/powerpc/platforms/83xx/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int mpc831x_usb_cfg(void)
out_be32(immap + MPC83XX_SCCR_OFFS, temp);

/* Configure pin mux for ULPI. There is no pin mux for UTMI */
if (!strcmp(prop, "ulpi")) {
if (prop && !strcmp(prop, "ulpi")) {
temp = in_be32(immap + MPC83XX_SICRL_OFFS);
temp &= ~MPC831X_SICRL_USB_MASK;
temp |= MPC831X_SICRL_USB_ULPI;
Expand All @@ -153,13 +153,13 @@ int mpc831x_usb_cfg(void)
usb_regs = ioremap(res.start, res.end - res.start + 1);

/* Using on-chip PHY */
if (!strcmp(prop, "utmi_wide") ||
!strcmp(prop, "utmi")) {
if (prop && (!strcmp(prop, "utmi_wide") ||
!strcmp(prop, "utmi"))) {
/* Set UTMI_PHY_EN, REFSEL to 48MHZ */
out_be32(usb_regs + FSL_USB2_CONTROL_OFFS,
CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ);
/* Using external UPLI PHY */
} else if (!strcmp(prop, "ulpi")) {
} else if (prop && !strcmp(prop, "ulpi")) {
/* Set PHY_CLK_SEL to ULPI */
temp = CONTROL_PHY_CLK_SEL_ULPI;
#ifdef CONFIG_USB_OTG
Expand Down

0 comments on commit 7ac3341

Please sign in to comment.