Skip to contentSkip to conversation

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

PATCH New Jeremy Gebben 2 participants 3 messages Jul 20, 2018 – Jul 27, 2018

lore
Share & tools
lore
#0 lore raw

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

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

Cc Stefano Babic <[email protected]>
Cc York Sun <[email protected]>
---
 drivers/ddr/fsl/options.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/ddr/fsl/options.c +6 -8
index 5f2acb1c9d..7639a8b3dd 100644
@@ -742,8 +742,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
 			unsigned int ctrl_num)
 {
 	unsigned int i;
-	char buffer[HWCONFIG_BUFFER_SIZE];
-	char *buf = NULL;
+	char buf[HWCONFIG_BUFFER_SIZE];
 #if defined(CONFIG_SYS_FSL_DDR3) || \
 	defined(CONFIG_SYS_FSL_DDR2) || \
 	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
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
-		buf = buffer;
+	if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
+		buf[0] = '\0';
 
 #if defined(CONFIG_SYS_FSL_DDR3) || \
 	defined(CONFIG_SYS_FSL_DDR2) || \
@@ -1398,15 +1397,14 @@ int fsl_use_spd(void)
 	int use_spd = 0;
 
 #ifdef CONFIG_DDR_SPD
-	char buffer[HWCONFIG_BUFFER_SIZE];
-	char *buf = NULL;
+	char buf[HWCONFIG_BUFFER_SIZE];
 
 	/*
 	 * Extract hwconfig from environment since we have not properly setup
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
-		buf = buffer;
+	if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
+		buf[0] = '\0';
 
 	/* if hwconfig is not enabled, or "sdram" is not defined, use spd */
 	if (hwconfig_sub_f("fsl_ddr", "sdram", buf)) {
Signature · 1 line
2.17.1
#1 lore raw

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

Quoted 25 lines · Jeremy Gebben

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

Cc Stefano Babic <[email protected]>
Cc York Sun <[email protected]>
---
 drivers/ddr/fsl/options.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/ddr/fsl/options.c +1 -2
index 5f2acb1c9d..7639a8b3dd 100644
@@ -742,8 +742,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
 			unsigned int ctrl_num)
 {
 	unsigned int i;
-	char buffer[HWCONFIG_BUFFER_SIZE];
-	char *buf = NULL;
+	char buf[HWCONFIG_BUFFER_SIZE];
 #if defined(CONFIG_SYS_FSL_DDR3) || \
 	defined(CONFIG_SYS_FSL_DDR2) || \
 	defined(CONFIG_SYS_FSL_DDR4)

drivers/ddr/fsl/options.c unsigned int populate_memctl_options(const common_timing_params_t *common_dimm, · line 761

Quoted 8 lines
drivers/ddr/fsl/options.c +2 -2
@@ -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
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
-		buf = buffer;
+	if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
+		buf[0] = '\0';
 

Thanks for bringing it up.