public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/4] exynos: Properly initialize host_caps in s5p_sdhci_core_init()
Date: Mon, 28 Sep 2015 19:21:53 +0200	[thread overview]
Message-ID: <56097731.5070303@samsung.com> (raw)
In-Reply-To: <1443201500-9256-1-git-send-email-tjakobi@math.uni-bielefeld.de>

Hello Tobias,

On 09/25/2015 07:18 PM, Tobias Jakobi wrote:
> The sdhci_host struct is allocated in s5p_sdhci_init() but the
> fields are not initialized.
>
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
>   drivers/mmc/s5p_sdhci.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
> index 4db51d6..e9c43a9 100644
> --- a/drivers/mmc/s5p_sdhci.c
> +++ b/drivers/mmc/s5p_sdhci.c
> @@ -76,6 +76,7 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
>   	host->set_control_reg = &s5p_sdhci_set_control_reg;
>   	host->set_clock = set_mmc_clk;
>
> +	host->host_caps = 0;
>   	if (host->bus_width == 8)
>   		host->host_caps |= MMC_MODE_8BIT;
>
>

Good point, but we usually initialize only required fields of structures.

What about use of calloc() instead of malloc() for this structure 
allocation, in s5p_sdhci_init() function?

Some time ago, the the memory reserved for malloc was initialized with 
zeroes at early init, so potentially "bugs" like this one, were hidden 
very well.

Best regards,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

      parent reply	other threads:[~2015-09-28 17:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 17:18 [U-Boot] [PATCH v2 1/4] exynos: Properly initialize host_caps in s5p_sdhci_core_init() Tobias Jakobi
2015-09-25 17:18 ` [U-Boot] [PATCH v2 2/4] exynos: Fix passing of errors in exynos_mmc_init() Tobias Jakobi
2015-09-28 17:22   ` Przemyslaw Marczak
2015-09-25 17:18 ` [U-Boot] [PATCH v2 3/4] exynos: be more verbose in process_nodes() Tobias Jakobi
2015-09-28 17:22   ` Przemyslaw Marczak
2015-09-25 17:18 ` [U-Boot] [PATCH v2 4/4] exynos: more debug and cleanup in do_sdhci_init() Tobias Jakobi
2015-09-28 17:22   ` Przemyslaw Marczak
2015-09-28 17:21 ` Przemyslaw Marczak [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=56097731.5070303@samsung.com \
    --to=p.marczak@samsung.com \
    --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