summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 20:47:19 +0300
committerTom Rini <trini@konsulko.com>2023-01-24 02:11:39 +0300
commit67bb9731221a70e23d185b7de43dd27cc986fa00 (patch)
tree1d423806371c0390fe7437e68fd7a8987a3c506f /drivers
parent3f23ce2b6c58a489b3377e1fc1449ca293892546 (diff)
downloadu-boot-67bb9731221a70e23d185b7de43dd27cc986fa00.tar.xz
sandbox: mmc: Start off with a zeroed file
When running multiple tests the mmc emulator calls malloc() to obtain the memory for its disk image. Since the memory is not cleared, it is possible that it happens to contain a partition table. The dm_test_part() test (for one) relies on mmc0 being empty on startup. Zero the memory to ensure that it is. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/sandbox_mmc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index ba79a5565c..0ba7940a4d 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -183,7 +183,7 @@ static int sandbox_mmc_probe(struct udevice *dev)
priv->csize = 0;
priv->size = (priv->csize + 1) * SIZE_MULTIPLE; /* 1 MiB */
- priv->buf = malloc(priv->size);
+ priv->buf = calloc(1, priv->size);
if (!priv->buf) {
log_err("%s: Not enough memory (%x bytes)\n",
dev->name, priv->size);