Commit c091c71a authored by Marek Szyprowski's avatar Marek Szyprowski

x86: dma-mapping: fix GFP_ATOMIC macro usage

GFP_ATOMIC is not a single gfp flag, but a macro which expands to the other
flags, where meaningful is the LACK of __GFP_WAIT flag. To check if caller
wants to perform an atomic allocation, the code must test for a lack of the
__GFP_WAIT flag. This patch fixes the issue introduced in v3.5-rc1.

CC: stable@vger.kernel.org
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
parent 10c8562f
...@@ -100,8 +100,10 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, ...@@ -100,8 +100,10 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
flag |= __GFP_ZERO; flag |= __GFP_ZERO;
again: again:
page = NULL; page = NULL;
if (!(flag & GFP_ATOMIC)) /* CMA can be used only in the context which permits sleeping */
if (flag & __GFP_WAIT)
page = dma_alloc_from_contiguous(dev, count, get_order(size)); page = dma_alloc_from_contiguous(dev, count, get_order(size));
/* fallback */
if (!page) if (!page)
page = alloc_pages_node(dev_to_node(dev), flag, get_order(size)); page = alloc_pages_node(dev_to_node(dev), flag, get_order(size));
if (!page) if (!page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment