summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolin Chen <nicolinc@nvidia.com>2022-10-18 01:02:36 +0200
committerJason Gunthorpe <jgg@nvidia.com>2022-11-01 18:39:59 +0100
commit04cee82e04d2aff3d177ef0021ecdff228daf7b8 (patch)
tree90f8594160033bc1804a9eed311d8f78129134b9
parentiommu: Use EINVAL for incompatible device/domain in ->attach_dev (diff)
downloadlinux-04cee82e04d2aff3d177ef0021ecdff228daf7b8.tar.xz
linux-04cee82e04d2aff3d177ef0021ecdff228daf7b8.zip
iommu: Propagate return value in ->attach_dev callback functions
The mtk_iommu and virtio drivers have places in the ->attach_dev callback functions that return hardcode errnos instead of the returned values, but callers of these ->attach_dv callback functions may care. Propagate them directly without the extra conversions. Link: https://lore.kernel.org/r/ca8c5a447b87002334f83325f28823008b4ce420.1666042873.git.nicolinc@nvidia.com Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Yong Wu <yong.wu@mediatek.com> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r--drivers/iommu/mtk_iommu.c2
-rw-r--r--drivers/iommu/virtio-iommu.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index eda441d0c6b6..b383c8327f9c 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -668,7 +668,7 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain,
ret = mtk_iommu_domain_finalise(dom, frstdata, region_id);
if (ret) {
mutex_unlock(&dom->mutex);
- return -ENODEV;
+ return ret;
}
dom->bank = &data->bank[bankid];
}
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 8226b4da4350..5b8fe9bfa9a5 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -697,7 +697,7 @@ static int viommu_domain_finalise(struct viommu_endpoint *vdev,
if (ret) {
ida_free(&viommu->domain_ids, vdomain->id);
vdomain->viommu = NULL;
- return -EOPNOTSUPP;
+ return ret;
}
}