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

Commit e19eb3fb authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dma-mapping: check for failed IOVA allocation" into msm-4.8

parents 8b50dcf5 5ee55de8
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1667,6 +1667,11 @@ int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg,
		total_length += s->length;
		total_length += s->length;


	iova = __alloc_iova(mapping, total_length);
	iova = __alloc_iova(mapping, total_length);
	if (iova == DMA_ERROR_CODE) {
		dev_err(dev, "Couldn't allocate iova for sg %p\n", sg);
		return 0;
	}

	ret = iommu_map_sg(mapping->domain, iova, sg, nents, prot);
	ret = iommu_map_sg(mapping->domain, iova, sg, nents, prot);
	if (ret != total_length) {
	if (ret != total_length) {
		__free_iova(mapping, iova, total_length);
		__free_iova(mapping, iova, total_length);