Skip to contentSkip to conversation

powerpc/usb: Fix usb device-tree fix-up

PATCH Superseded Ramneek Mehresh 2 participants 2 messages Feb 8, 2013 PowerPC

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/usb: Fix usb device-tree fix-up

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

---
Changes for v2:
- changed "WARNING" message to "ERROR" message

 arch/powerpc/cpu/mpc8xxx/fdt.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/powerpc/cpu/mpc8xxx/fdt.c +6 -0
index 2847094..857adeb 100644
@@ -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];
 
Signature · 1 line
1.7.11.4
#1 lore raw

PATCH v2 1/1 powerpc/usb: Fix usb device-tree fix-up

Dear Ramneek Mehresh,

arch/powerpc/cpu/mpc8xxx/fdt.c void fdt_fixup_dr_usb(void *blob, bd_t *bd) · line 172

Quoted 3 lines · In message <[email protected]>…
arch/powerpc/cpu/mpc8xxx/fdt.c +2 -0
+				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

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The main thing is the play itself. I swear that greed for  money  has
nothing  to  do with it, although heaven knows I am sorely in need of
money.                                           - Feodor Dostoyevsky