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

Commit 05e79899 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "staging: android: ion: Properly zero cached carveout allocations"

parents f710a168 f7cede6e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
	struct sg_table *table;
	ion_phys_addr_t paddr;
	int ret;
	struct device *dev = heap->priv;

	if (align > PAGE_SIZE)
		return -EINVAL;
@@ -95,8 +96,19 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
	}

	sg_set_page(table->sgl, pfn_to_page(PFN_DOWN(paddr)), size, 0);
	/*
	 * This is not correct - sg_dma_address needs a dma_addr_t that is valid
	 * for the targeted device, but this works on the currently targeted
	 * hardware.
	 */
	sg_dma_address(table->sgl) = sg_phys(table->sgl);

	buffer->priv_virt = table;

	if (ion_buffer_cached(buffer))
		dma_sync_sg_for_cpu(dev, table->sgl, table->nents,
				    DMA_BIDIRECTIONAL);

	return 0;

err_free_table: