Skip to content

Commit

Permalink
UPSTREAM: dm: core: Round up size when allocating so that it is cache…
Browse files Browse the repository at this point in the history
… 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.

Change-Id: I29c4fb89f4be628518c2f5350d3efbccd28acd36
Signed-off-by: Faiz Abbas <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Kever Yang <[email protected]>
(cherry picked from commit 5924da1)
  • Loading branch information
Faiz-Abbas authored and keveryang committed Jan 17, 2018
1 parent 90d0ce4 commit 9ab2e5e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9ab2e5e

Please sign in to comment.