public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jeroen Hofstee <dasuboot@myspectrum.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] mmc: fsl_esdhc: Use calloc()
Date: Thu, 27 Dec 2012 22:53:28 +0100	[thread overview]
Message-ID: <50DCC358.5000604@myspectrum.nl> (raw)
In-Reply-To: <1356634268-16297-1-git-send-email-festevam@gmail.com>

On 12/27/2012 07:51 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> A malloc() followed by memset() can be simply replaced by calloc().
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Change since v1:
> - Fix commit log
>   drivers/mmc/fsl_esdhc.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index e93e38a..5fc1c36 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -595,8 +595,7 @@ int fsl_esdhc_mmc_init(bd_t *bis)
>   {
>   	struct fsl_esdhc_cfg *cfg;
>   
> -	cfg = malloc(sizeof(struct fsl_esdhc_cfg));
> -	memset(cfg, 0, sizeof(struct fsl_esdhc_cfg));
> +	cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1);
>   	cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR;
>   	cfg->sdhc_clk = gd->sdhc_clk;
>   	return fsl_esdhc_initialize(bis, cfg);
nitpicking: if you're cleaning up, why not swap the arguments to calloc ;)

Regards,
Jeroen

      reply	other threads:[~2012-12-27 21:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 18:51 [U-Boot] [PATCH v2] mmc: fsl_esdhc: Use calloc() Fabio Estevam
2012-12-27 21:53 ` Jeroen Hofstee [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50DCC358.5000604@myspectrum.nl \
    --to=dasuboot@myspectrum.nl \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox