mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 08:01:08 +00:00
mmc/dwmmc: Using calloc instead malloc
To enhance the SDMMC DesignWare driver to use calloc instead of malloc. This will avoid the incident that uninitialized members of mmc structure are later used for NULL comparison. Signed-off-by: Chin Liang See <clsee@altera.com> Cc: Rajeshwari Shinde <rajeshwari.s@samsung.com> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Mischa Jonker <mjonker@synopsys.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Cc: Andy Fleming <afleming@freescale.com> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
This commit is contained in:
parent
dae6c6ba95
commit
fd26b5490b
1 changed files with 2 additions and 2 deletions
4
drivers/mmc/dw_mmc.c
Normal file → Executable file
4
drivers/mmc/dw_mmc.c
Normal file → Executable file
|
@ -336,9 +336,9 @@ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk)
|
|||
struct mmc *mmc;
|
||||
int err = 0;
|
||||
|
||||
mmc = malloc(sizeof(struct mmc));
|
||||
mmc = calloc(sizeof(struct mmc), 1);
|
||||
if (!mmc) {
|
||||
printf("mmc malloc fail!\n");
|
||||
printf("mmc calloc fail!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue