diff options
author | Nicolin Chen <nicolinc@nvidia.com> | 2022-10-18 02:02:21 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2022-11-01 20:39:59 +0300 |
commit | f4a14773579302e5f0c4bf80b03f0db7ce67f2ce (patch) | |
tree | b3a260911369cf6b131b7926874c4ae69cd005c6 /drivers/iommu/sprd-iommu.c | |
parent | bd7ebb7719356d750b1b4d671535922bae43fb3b (diff) | |
download | linux-f4a14773579302e5f0c4bf80b03f0db7ce67f2ce.tar.xz |
iommu: Use EINVAL for incompatible device/domain in ->attach_dev
Following the new rules in include/linux/iommu.h kdocs, update all drivers
->attach_dev callback functions to return EINVAL in the failure paths that
are related to domain incompatibility.
Also, drop adjacent error prints to prevent a kernel log spam.
Link: https://lore.kernel.org/r/f52a07f7320da94afe575c9631340d0019a203a7.1666042873.git.nicolinc@nvidia.com
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu/sprd-iommu.c')
-rw-r--r-- | drivers/iommu/sprd-iommu.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c index fadd2c907222..e02793375598 100644 --- a/drivers/iommu/sprd-iommu.c +++ b/drivers/iommu/sprd-iommu.c @@ -237,10 +237,8 @@ static int sprd_iommu_attach_device(struct iommu_domain *domain, struct sprd_iommu_domain *dom = to_sprd_domain(domain); size_t pgt_size = sprd_iommu_pgt_size(domain); - if (dom->sdev) { - pr_err("There's already a device attached to this domain.\n"); + if (dom->sdev) return -EINVAL; - } dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL); if (!dom->pgt_va) |