[PATCH master 13/23] commands: mmc_extcsd: use DMA capable memory where needed

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 23 23:40:48 PDT 2024


mci_send_ext_csd may do DMA directly to the passed in buffer. Therefore,
be sure to allocate the buffer with suitable alignment.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 commands/mmc_extcsd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index f67c48404a54..993a6dd12b23 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -2418,7 +2418,7 @@ static int do_mmc_extcsd(int argc, char *argv[])
 		retval = -ENOENT;
 		goto error;
 	}
-	dst = xmalloc(EXT_CSD_BLOCKSIZE);
+	dst = dma_alloc(EXT_CSD_BLOCKSIZE);
 
 	retval = mci_send_ext_csd(mci, dst);
 	if (retval != 0)
@@ -2473,7 +2473,7 @@ static int do_mmc_extcsd(int argc, char *argv[])
 			print_register_readable(dst, index);
 
 error_with_mem:
-	free(dst);
+	dma_free(dst);
 error:
 	return retval;
 }
-- 
2.39.2




More information about the barebox mailing list