All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages
@ 2018-07-20 22:00 Jeremy Gebben
  2018-07-20 22:06 ` York Sun
  2018-07-27 15:36 ` York Sun
  0 siblings, 2 replies; 3+ messages in thread
From: Jeremy Gebben @ 2018-07-20 22:00 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/ddr/fsl/options.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index 5f2acb1c9d..7639a8b3dd 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -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)) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages
  2018-07-20 22:00 [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages Jeremy Gebben
@ 2018-07-20 22:06 ` York Sun
  2018-07-27 15:36 ` York Sun
  1 sibling, 0 replies; 3+ messages in thread
From: York Sun @ 2018-07-20 22:06 UTC (permalink / raw)
  To: u-boot

On 07/20/2018 03:00 PM, Jeremy Gebben wrote:
> 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>
> ---
>  drivers/ddr/fsl/options.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> index 5f2acb1c9d..7639a8b3dd 100644
> --- a/drivers/ddr/fsl/options.c
> +++ b/drivers/ddr/fsl/options.c
> @@ -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';
>  

Thanks for bringing it up.

Reviewed-by: York Sun <york.sun@nxp.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages
  2018-07-20 22:00 [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages Jeremy Gebben
  2018-07-20 22:06 ` York Sun
@ 2018-07-27 15:36 ` York Sun
  1 sibling, 0 replies; 3+ messages in thread
From: York Sun @ 2018-07-27 15:36 UTC (permalink / raw)
  To: u-boot

On 07/20/2018 03:00 PM, Jeremy Gebben wrote:
> 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>
> ---

Applied to fsl-qoriq, awaiting upstream.
Thanks.

York

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-27 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 22:00 [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages Jeremy Gebben
2018-07-20 22:06 ` York Sun
2018-07-27 15:36 ` York Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.