ARM64: dma-mapping: zero the buffer that allocate with __GFP_ZERO flags
authorCMY <cmy@rock-chips.com>
Sat, 14 Feb 2015 08:03:06 +0000 (16:03 +0800)
committerCMY <cmy@rock-chips.com>
Sat, 14 Feb 2015 08:03:06 +0000 (16:03 +0800)
arch/arm64/mm/dma-mapping.c

index eeb1cf3ff2999316d25f9cc6ef83e4d534042e26..aff368c35d62eb6b7181fe75e04d8ebe48d2319b 100644 (file)
@@ -158,6 +158,9 @@ static void *__dma_alloc_noncoherent(struct device *dev, size_t size,
        if (!ptr)
                goto no_mem;
 
+       if (flags & __GFP_ZERO)
+               memset(ptr, 0, size);
+
        /* remove any dirty cache lines on the kernel alias */
        __dma_flush_range(ptr, ptr + size);