diff --git a/drivers/base/dma-removed.c b/drivers/base/dma-removed.c index 0763e8db41bd..0da44ded61db 100644 --- a/drivers/base/dma-removed.c +++ b/drivers/base/dma-removed.c @@ -79,17 +79,19 @@ void *removed_alloc(struct device *dev, size_t size, dma_addr_t *handle, attrs); bool skip_zeroing = dma_get_attr(DMA_ATTR_SKIP_ZEROING, attrs); int pageno; - unsigned long order = get_order(size); + unsigned long order; void *addr = NULL; struct removed_region *dma_mem = dev->removed_mem; - int nbits = size >> PAGE_SHIFT; + int nbits; unsigned int align; - size = PAGE_ALIGN(size); - if (!(gfp & __GFP_WAIT)) return NULL; + size = PAGE_ALIGN(size); + nbits = size >> PAGE_SHIFT; + order = get_order(size); + if (order > get_order(SZ_1M)) order = get_order(SZ_1M);