From 5924da1dfe56d32a45b8adf29bdc8caf788bd4c8 Mon Sep 17 00:00:00 2001 From: Faiz Abbas Date: Tue, 19 Sep 2017 16:53:50 +0530 Subject: [PATCH] dm: core: Round up size when allocating so that it is cache line aligned The size variable may not be always be a mulitple of ARCH_DMA_MINALIGN and using it to flush cache leads to cache misaligned warnings. Therefore, round up the size to a multiple of ARCH_DMA_MINLAIGN when allocating private data. Signed-off-by: Faiz Abbas Reviewed-by: Simon Glass --- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/core/device.c b/drivers/core/device.c index de63e5335a..9a46a7bbe5 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -254,6 +254,7 @@ static void *alloc_priv(int size, uint flags) void *priv; if (flags & DM_FLAG_ALLOC_PRIV_DMA) { + size = ROUND(size, ARCH_DMA_MINALIGN); priv = memalign(ARCH_DMA_MINALIGN, size); if (priv) { memset(priv, '\0', size); -- 2.39.5