drivers/ddr/fsl: fix '__hwconfig without a buffer' messages

Pass an empty buffer instead of NULL if the hwconfig environment
variable isn't set.

Signed-off-by: Jeremy Gebben <jgebben@sweptlaser.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: York Sun <york.sun@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
This commit is contained in:
Jeremy Gebben 2018-07-20 16:00:36 -06:00 committed by York Sun
parent 038b965c2b
commit 86b840b78d

View file

@ -742,8 +742,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
unsigned int ctrl_num) unsigned int ctrl_num)
{ {
unsigned int i; unsigned int i;
char buffer[HWCONFIG_BUFFER_SIZE]; char buf[HWCONFIG_BUFFER_SIZE];
char *buf = NULL;
#if defined(CONFIG_SYS_FSL_DDR3) || \ #if defined(CONFIG_SYS_FSL_DDR3) || \
defined(CONFIG_SYS_FSL_DDR2) || \ defined(CONFIG_SYS_FSL_DDR2) || \
defined(CONFIG_SYS_FSL_DDR4) defined(CONFIG_SYS_FSL_DDR4)
@ -757,8 +756,8 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
* Extract hwconfig from environment since we have not properly setup * Extract hwconfig from environment since we have not properly setup
* the environment but need it for ddr config params * the environment but need it for ddr config params
*/ */
if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0) if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
buf = buffer; buf[0] = '\0';
#if defined(CONFIG_SYS_FSL_DDR3) || \ #if defined(CONFIG_SYS_FSL_DDR3) || \
defined(CONFIG_SYS_FSL_DDR2) || \ defined(CONFIG_SYS_FSL_DDR2) || \
@ -1398,15 +1397,14 @@ int fsl_use_spd(void)
int use_spd = 0; int use_spd = 0;
#ifdef CONFIG_DDR_SPD #ifdef CONFIG_DDR_SPD
char buffer[HWCONFIG_BUFFER_SIZE]; char buf[HWCONFIG_BUFFER_SIZE];
char *buf = NULL;
/* /*
* Extract hwconfig from environment since we have not properly setup * Extract hwconfig from environment since we have not properly setup
* the environment but need it for ddr config params * the environment but need it for ddr config params
*/ */
if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0) if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
buf = buffer; buf[0] = '\0';
/* if hwconfig is not enabled, or "sdram" is not defined, use spd */ /* if hwconfig is not enabled, or "sdram" is not defined, use spd */
if (hwconfig_sub_f("fsl_ddr", "sdram", buf)) { if (hwconfig_sub_f("fsl_ddr", "sdram", buf)) {