[U-Boot,v2] powerpc/usb: Fix usb device-tree fix-up

Submitted by ramneek mehresh on Feb. 8, 2013, 4:14 a.m.

Details

Message ID 1360296886-2444-1-git-send-email-ramneek.mehresh@freescale.com
State Superseded
Headers show

Commit Message

ramneek mehresh Feb. 8, 2013, 4:14 a.m.
Fix USB device-tree fixup to properly handle device-tree fixup and
print appropriate message when wrong/junk "dr_mode" or "phy_type"
are mentioned in hwconfig string

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
---
Changes for v2:
	- changed "WARNING" message to "ERROR" message

 arch/powerpc/cpu/mpc8xxx/fdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Wolfgang Denk Feb. 8, 2013, 5:19 a.m.
Dear Ramneek Mehresh,

In message <1360296886-2444-1-git-send-email-ramneek.mehresh@freescale.com> you wrote:
>
> +				printf("ERROR: wrong usb mode/phy"
> +					" defined!!\n");

1) Please do not split the error message across lines. Quoting
   CodingStyle, Chapter 2: Breaking long lines and strings:

   	However, never break user-visible strings such as printk
	messages, because that breaks the ability to grep for them.

2) There is no formatting needed, so you can use puts() rather
   printf()

Best regards,

Wolfgang Denk

Patch hide | download patch | download mbox

diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
index 2847094..857adeb 100644
--- a/arch/powerpc/cpu/mpc8xxx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
@@ -167,6 +167,12 @@  void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 				}
 			}
 
+			if (mode_idx < 0 || phy_idx < 0) {
+				printf("ERROR: wrong usb mode/phy"
+					" defined!!\n");
+				return;
+			}
+
 			dr_mode_type = modes[mode_idx];
 			dr_phy_type = phys[phy_idx];