From mboxrd@z Thu Jan 1 00:00:00 1970 From: Przemyslaw Marczak Date: Mon, 28 Sep 2015 19:21:53 +0200 Subject: [U-Boot] [PATCH v2 1/4] exynos: Properly initialize host_caps in s5p_sdhci_core_init() In-Reply-To: <1443201500-9256-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1443201500-9256-1-git-send-email-tjakobi@math.uni-bielefeld.de> Message-ID: <56097731.5070303@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.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 > Signed-off-by: Tobias Jakobi > --- > 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