Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e8dd5f0 authored by Shiraz Hashim's avatar Shiraz Hashim Committed by Liam Mark
Browse files

drivers: dma-removed: align size first



Align size first and then find required number of bits and
order out of it.

Change-Id: I9b12fb45e5c1ff79e24fe7584cd23923b1a88c87
Signed-off-by: default avatarShiraz Hashim <shashim@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent e8f4ec14
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -78,17 +78,19 @@ void *removed_alloc(struct device *dev, size_t size, dma_addr_t *handle,
	bool no_kernel_mapping = attrs & DMA_ATTR_NO_KERNEL_MAPPING;
	bool no_kernel_mapping = attrs & DMA_ATTR_NO_KERNEL_MAPPING;
	bool skip_zeroing = attrs & DMA_ATTR_SKIP_ZEROING;
	bool skip_zeroing = attrs & DMA_ATTR_SKIP_ZEROING;
	int pageno;
	int pageno;
	unsigned long order = get_order(size);
	unsigned long order;
	void *addr = NULL;
	void *addr = NULL;
	struct removed_region *dma_mem = dev->removed_mem;
	struct removed_region *dma_mem = dev->removed_mem;
	int nbits = size >> PAGE_SHIFT;
	int nbits;
	unsigned int align;
	unsigned int align;


	size = PAGE_ALIGN(size);

	if (!gfpflags_allow_blocking(gfp))
	if (!gfpflags_allow_blocking(gfp))
		return NULL;
		return NULL;


	size = PAGE_ALIGN(size);
	nbits = size >> PAGE_SHIFT;
	order = get_order(size);

	if (order > get_order(SZ_1M))
	if (order > get_order(SZ_1M))
		order = get_order(SZ_1M);
		order = get_order(SZ_1M);