Commit 55e0f0d1 authored by Mikko Perttunen's avatar Mikko Perttunen Committed by Rob Clark
Browse files

drm/msm: Fix iommu_map_sgtable() return value check and avoid WARN



Commit "iommu: return full error code from iommu_map_sg[_atomic]()"
changed iommu_map_sgtable() to return an ssize_t and negative values
in error cases, rather than a size_t and a zero.

Store the return value in the appropriate type and in case of error,
return it rather than WARNing.

Fixes: ad8f36e4 ("iommu: return full error code from iommu_map_sg[_atomic]()")
Signed-off-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Patchwork: https://patchwork.freedesktop.org/patch/719685/


Message-ID: <20260421-iommu_map_sgtable-return-v1-3-fb484c07d2a1@nvidia.com>
Signed-off-by: default avatarRob Clark <robin.clark@oss.qualcomm.com>
parent 78d79c61
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -677,7 +677,7 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova,
			 int prot)
{
	struct msm_iommu *iommu = to_msm_iommu(mmu);
	size_t ret;
	ssize_t ret;

	WARN_ON(off != 0);

@@ -686,7 +686,8 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova,
		iova |= GENMASK_ULL(63, 49);

	ret = iommu_map_sgtable(iommu->domain, iova, sgt, prot);
	WARN_ON(!ret);
	if (ret < 0)
		return ret;

	return (ret == len) ? 0 : -EINVAL;
}