From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Sun Date: Fri, 20 Jul 2018 22:06:49 +0000 Subject: [U-Boot] [PATCH] drivers/ddr/fsl: fix '__hwconfig without a buffer' messages References: <20180720220036.15168-1-jgebben@sweptlaser.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > Cc: Stefano Babic > Cc: York Sun > --- > 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