[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd613152e5175b5ffac643ee017b1d800e766d99.1663227492.git.nicolinc@nvidia.com>
Date: Thu, 15 Sep 2022 00:58:45 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <yong.wu@...iatek.com>, <joro@...tes.org>, <will@...nel.org>,
<robin.murphy@....com>, <matthias.bgg@...il.com>,
<jean-philippe@...aro.org>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <iommu@...ts.linux.dev>,
<linux-mediatek@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<virtualization@...ts.linux-foundation.org>
Subject: [PATCH v3 6/6] iommu: Propagate ret for a potential soft failure EINVAL
Following the new rules in include/linux/iommu.h kdocs, EINVAL now can be
used to indicate that domain and device are incompatible by a caller that
treats it as a soft failure and tries attaching to another domain.
Either mtk_iommu or virtio driver has a place that returns a hard failure
instead of the return value from the function call, where an incompatible
errno EINVAL could potentially occur.
Propagate the real return value to not miss a potential soft failure.
Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
---
drivers/iommu/mtk_iommu.c | 2 +-
drivers/iommu/virtio-iommu.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index be1a7d1cc630..c30dc8f81778 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -666,7 +666,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 caca0a638c4d..f1ecc5589626 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -696,7 +696,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;
}
}
--
2.17.1
Powered by blists - more mailing lists