gpu: ion: Only set the dma_address if it isn't already set

Certain heaps such as the carveout heap need to set the dma_address
of the scatterlist in a way without relying on sg_phys. Only
set the dma_address if it isn't already set.

Change-Id: I9d971557d08c79447908523f69a8f1cc5fa79f6a
CRs-Fixed: 469300
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index 85e2ec9..16c2900 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -261,8 +261,10 @@
 	   allocation via dma_map_sg. The implicit contract here is that
 	   memory comming from the heaps is ready for dma, ie if it has a
 	   cached mapping that mapping has been invalidated */
-	for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i)
-		sg_dma_address(sg) = sg_phys(sg);
+	for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) {
+		if (sg_dma_address(sg) == 0)
+			sg_dma_address(sg) = sg_phys(sg);
+	}
 	ion_buffer_add(dev, buffer);
 	return buffer;