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

Commit 14821273 authored by Shiraz Hashim's avatar Shiraz Hashim
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>
parent 33365bf7
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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);