Skip to contentSkip to conversation

mmc: Fix uninitialised priv member

PATCH New Alex Kiernan 4 participants 4 messages Feb 9, 2018 – Feb 19, 2018 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: Fix uninitialised priv member

When using omap_hsmmc without the device model then the allocation of mmc->priv ends up uninitialised.

---
I've a board (AM335xx based) which boots fine with 2018-01, with 2018-03-rc1 (actually 1811a92) it fails in the MLO:

U-Boot SPL 2018.03-rc1-00222-g128a503-dirty (Feb 09 2018 - 11:51:50 +0000) Trying to boot from MMC2
omap_hsmmc_send_cmd : DMA timeout: No status update
mmc_init: -110, time 1026
spl: mmc init failed with error: -110
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Bisecting it out, it's this commit:

f0d53e8 mmc: omap_hsmmc: Add support for DMA (ADMA2)

 drivers/mmc/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/omap_hsmmc.c +1 -1
index b12d6d9..c6b3f25 100644
@@ -918,7 +918,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
 	struct mmc_config *cfg;
 	uint host_caps_val;
 
-	priv = malloc(sizeof(*priv));
+	priv = calloc(1, sizeof(*priv));
 	if (priv == NULL)
 		return -1;
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/1 mmc: Fix uninitialised priv member

In reply to Alex Kiernan
Quoted 4 lines · Alex Kiernan

When using omap_hsmmc without the device model then the allocation of mmc->priv ends up uninitialised.

A good one, thanks!

Quoted 39 lines

---
I've a board (AM335xx based) which boots fine with 2018-01, with 2018-03-rc1 (actually 1811a92) it fails in the MLO:

U-Boot SPL 2018.03-rc1-00222-g128a503-dirty (Feb 09 2018 - 11:51:50 +0000) Trying to boot from MMC2
omap_hsmmc_send_cmd : DMA timeout: No status update
mmc_init: -110, time 1026
spl: mmc init failed with error: -110
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Bisecting it out, it's this commit:

f0d53e8 mmc: omap_hsmmc: Add support for DMA (ADMA2)

 drivers/mmc/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/omap_hsmmc.c +1 -2
index b12d6d9..c6b3f25 100644
@@ -918,7 +918,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
        struct mmc_config *cfg;
        uint host_caps_val;
 
-       priv = malloc(sizeof(*priv));
+       priv = calloc(1, sizeof(*priv));
        if (priv == NULL)
                return -1;
 
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH 1/1 mmc: Fix uninitialised priv member

In reply to Alex Kiernan
Quoted 4 lines · Alex Kiernan

When using omap_hsmmc without the device model then the allocation of mmc->priv ends up uninitialised.

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

Quoted 33 lines

---
I've a board (AM335xx based) which boots fine with 2018-01, with 2018-03-rc1 (actually 1811a92) it fails in the MLO:

U-Boot SPL 2018.03-rc1-00222-g128a503-dirty (Feb 09 2018 - 11:51:50 +0000) Trying to boot from MMC2
omap_hsmmc_send_cmd : DMA timeout: No status update
mmc_init: -110, time 1026
spl: mmc init failed with error: -110
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Bisecting it out, it's this commit:

f0d53e8 mmc: omap_hsmmc: Add support for DMA (ADMA2)

 drivers/mmc/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/omap_hsmmc.c +1 -1
index b12d6d9..c6b3f25 100644
@@ -918,7 +918,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
 	struct mmc_config *cfg;
 	uint host_caps_val;
 
-	priv = malloc(sizeof(*priv));
+	priv = calloc(1, sizeof(*priv));
 	if (priv == NULL)
 		return -1;