MatrixVision common code: use getenv_f instead of snprintf.
PATCH 1/1 MatrixVision common code: use getenv_f instead of snprintf.
Signed-off-by Andre Schwarz <[email protected]>
--- board/matrix_vision/common/mv_common.c | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-)
board/matrix_vision/common/mv_common.c +13 -12
@@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;static char * entries_to_keep[] = {"serial#" ,"ethaddr" ,"eth1addr" ,"model_info" ,"sensor_cnt" ,"fpgadatasize" ,"ddr_size" ,"use_dhcp" ,"use_static_ipaddr" , -"static_ipaddr" ,"static_netmask" ,"static_gateway" , +"static_ipaddr" ,"static_netmask" ,"static_gateway" ,"boot_sqfs" ,"syslog" ,"watchdog" ,"netboot" ,"evo8serialnumber" };#define MV_MAX_ENV_ENTRY_LENGTH 64
@@ -41,28 +41,27 @@ static char* entries_to_keep[] = {void mv_reset_environment (void ) {int i; -char *s[MV_KEEP_ENTRIES ];char entries[MV_KEEP_ENTRIES ][MV_MAX_ENV_ENTRY_LENGTH ];printf ("\n*** RESET ENVIRONMENT ***\n" );memset (entries,0 ,MV_KEEP_ENTRIES *MV_MAX_ENV_ENTRY_LENGTH ); +for (i =0 ; i <MV_KEEP_ENTRIES ; i++) { - s[i] =getenv (entries_to_keep[i]); -if (s[i]) { -printf ("save '%s' : %s\n" , entries_to_keep[i], s[i]); -strncpy (entries[i], s[i],MV_MAX_ENV_ENTRY_LENGTH ); - } +if (getenv_f (entries_to_keep[i], entries[i], +MV_MAX_ENV_ENTRY_LENGTH ) <=0 ) +memset (entries[i],0 ,MV_MAX_ENV_ENTRY_LENGTH ); +else +printf ("save '%s' : %s\n" , entries_to_keep[i], + entries[i]); } gd->env_valid =0 ;env_relocate ();for (i =0 ; i <MV_KEEP_ENTRIES ; i++) { -if (s[i]) { -printf ("restore '%s' : %s\n" , entries_to_keep[i], s[i]); -setenv (entries_to_keep[i], s[i]); - } +printf ("restore '%s' : %s\n" , entries_to_keep[i], entries[i]); +setenv (entries_to_keep[i], entries[i]); }saveenv ();
@@ -70,7 +69,8 @@ void mv_reset_environment(void)int mv_load_fpga (void ) { -int result; +int result =-1 ; +#ifdef CONFIG_FPGA size_t data_size =0 ;void *fpga_data =NULL ;char *datastr =getenv ("fpgadata" );
@@ -92,6 +92,7 @@ int mv_load_fpga(void) } result =fpga_load (0 , fpga_data, data_size); +#endif if (!result)show_boot_progress (0 );
Signature · 1 line
1.7.0.4
PATCH 1/1 MatrixVision common code: use getenv_f instead of snprintf.
Dear Andre Schwarz,
Quoted 2 lines · In message <[email protected]>…
Signed-off-by Andre Schwarz <[email protected]>
It appears this commit contains some unrelated changes?
board/matrix_vision/common/mv_common.c DECLARE_GLOBAL_DATA_PTR; · line 35
Quoted 2 lines
board/matrix_vision/common/mv_common.c +1
-1- "static_ipaddr", "static_netmask", "static_gateway", + "static_ipaddr", "static_netmask", "static_gateway", "boot_sqfs",
...like this.
board/matrix_vision/common/mv_common.c int mv_load_fpga(void) · line 95
Quoted 13 lines
int
mv_load_fpga(void)
{board/matrix_vision/common/mv_common.c +3
-1-int result; +int result =-1 ; +#ifdef CONFIG_FPGA size_t data_size =0 ;void *fpga_data =NULL ;char *datastr =getenv ("fpgadata" );@@ -92,6 +92,7 @@ int mv_load_fpga(void) } result =fpga_load (0 , fpga_data, data_size); +#endif
... or that.
Please split into orthogonal changes.
Best regards,
Wolfgang Denk
Signature · 5 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 Another dream that failed. There's nothing sadder. -- Kirk, "This side of Paradise", stardate 3417.3