* [U-Boot] [PATCH]powerpc/8xxx: Cleanup USB device-tree fixup
@ 2012-02-07 5:17 Ramneek Mehresh
2012-02-26 23:14 ` Marek Vasut
0 siblings, 1 reply; 2+ messages in thread
From: Ramneek Mehresh @ 2012-02-07 5:17 UTC (permalink / raw)
To: u-boot
Some code cleanup done for USB device-tree fixup:
- handling error value returned from fdt_fixup_usb_mode_phy_type()
- using ARRAY_SIZE macro
- using snprintf instead of sprintf
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
---
KW Warnings fixed: using snprintf instead of sprintf
arch/powerpc/cpu/mpc8xxx/fdt.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
index d07ae1b..bc1c30e 100644
--- a/arch/powerpc/cpu/mpc8xxx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2011 Freescale Semiconductor, Inc.
+ * Copyright 2009-2012 Freescale Semiconductor, Inc.
*
* This file is derived from arch/powerpc/cpu/mpc85xx/cpu.c and
* arch/powerpc/cpu/mpc86xx/cpu.c. Basically this file contains
@@ -137,28 +137,34 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
for (i = 1; i <= FSL_MAX_NUM_USB_CTRLS; i++) {
int mode_idx = -1, phy_idx = -1;
- sprintf(str, "%s%d", "usb", i);
+ snprintf(str, 5, "%s%d", "usb", i);
if (hwconfig(str)) {
- for (j = 0; j < sizeof(modes); j++) {
+ for (j = 0; j < ARRAY_SIZE(modes); j++) {
if (hwconfig_subarg_cmp(str, "dr_mode",
modes[j])) {
mode_idx = j;
break;
}
}
- for (j = 0; j < sizeof(phys); j++) {
+ for (j = 0; j < ARRAY_SIZE(phys); j++) {
if (hwconfig_subarg_cmp(str, "phy_type",
phys[j])) {
phy_idx = j;
break;
}
}
- if (mode_idx >= 0)
+ if (mode_idx >= 0) {
usb_mode_off = fdt_fixup_usb_mode_phy_type(blob,
modes[mode_idx], NULL, usb_mode_off);
- if (phy_idx >= 0)
+ if (usb_mode_off < 0)
+ return;
+ }
+ if (phy_idx >= 0) {
usb_phy_off = fdt_fixup_usb_mode_phy_type(blob,
NULL, phys[phy_idx], usb_phy_off);
+ if (usb_phy_off < 0)
+ return;
+ }
if (!strcmp(str, "usb1"))
usb1_defined = 1;
if (mode_idx < 0 && phy_idx < 0)
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH]powerpc/8xxx: Cleanup USB device-tree fixup
2012-02-07 5:17 [U-Boot] [PATCH]powerpc/8xxx: Cleanup USB device-tree fixup Ramneek Mehresh
@ 2012-02-26 23:14 ` Marek Vasut
0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2012-02-26 23:14 UTC (permalink / raw)
To: u-boot
> Some code cleanup done for USB device-tree fixup:
> - handling error value returned from fdt_fixup_usb_mode_phy_type()
> - using ARRAY_SIZE macro
> - using snprintf instead of sprintf
>
> Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> ---
> KW Warnings fixed: using snprintf instead of sprintf
>
Hi,
what's the status of this patch/patchset?
Thanks
M
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-26 23:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-07 5:17 [U-Boot] [PATCH]powerpc/8xxx: Cleanup USB device-tree fixup Ramneek Mehresh
2012-02-26 23:14 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox