[U-Boot] [PATCH v3 6/7] omap_rev_string: output to stdout
Andreas Müller
schnitzeltony at gmx.de
Thu Jan 5 02:26:24 CET 2012
* avoid potential buffer overflows
* allow SPL-build not to output "Texas Instruments Revision detection unimplemented"
Signed-off-by: Andreas Müller <schnitzeltony at gmx.de>
---
arch/arm/cpu/armv7/omap-common/hwinit-common.c | 10 ++++------
arch/arm/cpu/armv7/omap-common/spl.c | 10 ++++------
arch/arm/include/asm/arch-omap4/sys_proto.h | 2 +-
arch/arm/include/asm/arch-omap5/sys_proto.h | 2 +-
arch/arm/include/asm/omap_common.h | 2 +-
5 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index f65705d..90ec44d 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -104,14 +104,14 @@ u32 cortex_rev(void)
return rev;
}
-void omap_rev_string(char *omap_rev_string)
+void omap_rev_string()
{
u32 omap_rev = omap_revision();
u32 omap_variant = (omap_rev & 0xFFFF0000) >> 16;
u32 major_rev = (omap_rev & 0x00000F00) >> 8;
u32 minor_rev = (omap_rev & 0x000000F0) >> 4;
- sprintf(omap_rev_string, "OMAP%x ES%x.%x", omap_variant, major_rev,
+ printf("OMAP%x ES%x.%x\n", omap_variant, major_rev,
minor_rev);
}
@@ -251,10 +251,8 @@ u32 get_device_type(void)
*/
int print_cpuinfo(void)
{
- char rev_string_buffer[50];
-
- omap_rev_string(rev_string_buffer);
- printf("CPU : %s\n", rev_string_buffer);
+ puts("CPU : ");
+ omap_rev_string();
return 0;
}
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
index 74fea4f..fdce2dc 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -154,7 +154,6 @@ void board_init_r(gd_t *id, ulong dummy)
void preloader_console_init(void)
{
const char *u_boot_rev = U_BOOT_VERSION;
- char rev_string_buffer[50];
gd = &gdata;
gd->bd = &bdata;
@@ -170,14 +169,13 @@ void preloader_console_init(void)
printf("\nU-Boot SPL %s (%s - %s)\n", u_boot_rev, U_BOOT_DATE,
U_BOOT_TIME);
- omap_rev_string(rev_string_buffer);
- printf("Texas Instruments %s\n", rev_string_buffer);
+ omap_rev_string();
}
-void __omap_rev_string(char *str)
+void __omap_rev_string()
{
- sprintf(str, "Revision detection unimplemented");
+ printf("Texas Instruments Revision detection unimplemented\n");
}
-void omap_rev_string(char *str)
+void omap_rev_string()
__attribute__((weak, alias("__omap_rev_string")));
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h
index 4146e21..7386adf 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -42,7 +42,7 @@ void sr32(void *, u32, u32, u32);
u32 wait_on_value(u32, u32, void *, u32);
void sdelay(unsigned long);
void set_pl310_ctrl_reg(u32 val);
-void omap_rev_string(char *omap_rev_string);
+void omap_rev_string();
void setup_clocks_for_console(void);
void prcm_init(void);
void bypass_dpll(u32 *const base);
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h b/arch/arm/include/asm/arch-omap5/sys_proto.h
index c31e18c..fd1ba39 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -42,7 +42,7 @@ void set_muxconf_regs_non_essential(void);
void sr32(void *, u32, u32, u32);
u32 wait_on_value(u32, u32, void *, u32);
void sdelay(unsigned long);
-void omap_rev_string(char *omap_rev_string);
+void omap_rev_string();
void setup_clocks_for_console(void);
void prcm_init(void);
void bypass_dpll(u32 *const base);
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 1ec651b..7e92ef2 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -86,7 +86,7 @@ u32 omap_boot_mode(void);
/* SPL common function s*/
void spl_parse_image_header(const struct image_header *header);
-void omap_rev_string(char *omap_rev_string);
+void omap_rev_string();
/* NAND SPL functions */
void spl_nand_load_image(void);
--
1.7.4.4
More information about the U-Boot
mailing list