powerpc/usb: Fix usb device-tree fix-up
authorramneek mehresh <ramneek.mehresh@freescale.com>
Sun, 17 Feb 2013 18:23:32 +0000 (18:23 +0000)
committerMarek Vasut <marex@denx.de>
Wed, 10 Apr 2013 13:22:25 +0000 (15:22 +0200)
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>
arch/powerpc/cpu/mpc8xxx/fdt.c

index 284709428d9c5c6907b43ac0a8b7e8e8bb183cb0..2db90455f60acab33bb4484ba7b8e431303281e2 100644 (file)
@@ -167,6 +167,11 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
                                }
                        }
 
+                       if (mode_idx < 0 || phy_idx < 0) {
+                               puts("ERROR: wrong usb mode/phy defined!!\n");
+                               return;
+                       }
+
                        dr_mode_type = modes[mode_idx];
                        dr_phy_type = phys[phy_idx];