Skip to content

Commit d912aed

Browse files
shavitmichaelwilldeacon
authored andcommitted
iommu/arm-smmu-v3-sva: Remove unused iommu_sva handle
The __arm_smmu_sva_bind function returned an unused iommu_sva handle that can be removed. Signed-off-by: Michael Shavit <mshavit@google.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20230905194849.v1.1.Ib483f67c9e2ad90ea2254b4b5ac696e4b68aa638@changeid Signed-off-by: Will Deacon <will@kernel.org>
1 parent 475918e commit d912aed

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ struct arm_smmu_mmu_notifier {
2525
#define mn_to_smmu(mn) container_of(mn, struct arm_smmu_mmu_notifier, mn)
2626

2727
struct arm_smmu_bond {
28-
struct iommu_sva sva;
2928
struct mm_struct *mm;
3029
struct arm_smmu_mmu_notifier *smmu_mn;
3130
struct list_head list;
@@ -376,8 +375,7 @@ static void arm_smmu_mmu_notifier_put(struct arm_smmu_mmu_notifier *smmu_mn)
376375
arm_smmu_free_shared_cd(cd);
377376
}
378377

379-
static struct iommu_sva *
380-
__arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
378+
static int __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
381379
{
382380
int ret;
383381
struct arm_smmu_bond *bond;
@@ -386,7 +384,7 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
386384
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
387385

388386
if (!master || !master->sva_enabled)
389-
return ERR_PTR(-ENODEV);
387+
return -ENODEV;
390388

391389
/* If bind() was already called for this {dev, mm} pair, reuse it. */
392390
list_for_each_entry(bond, &master->bonds, list) {
@@ -398,10 +396,9 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
398396

399397
bond = kzalloc(sizeof(*bond), GFP_KERNEL);
400398
if (!bond)
401-
return ERR_PTR(-ENOMEM);
399+
return -ENOMEM;
402400

403401
bond->mm = mm;
404-
bond->sva.dev = dev;
405402
refcount_set(&bond->refs, 1);
406403

407404
bond->smmu_mn = arm_smmu_mmu_notifier_get(smmu_domain, mm);
@@ -411,11 +408,11 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
411408
}
412409

413410
list_add(&bond->list, &master->bonds);
414-
return &bond->sva;
411+
return 0;
415412

416413
err_free_bond:
417414
kfree(bond);
418-
return ERR_PTR(ret);
415+
return ret;
419416
}
420417

421418
bool arm_smmu_sva_supported(struct arm_smmu_device *smmu)
@@ -593,13 +590,10 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
593590
struct device *dev, ioasid_t id)
594591
{
595592
int ret = 0;
596-
struct iommu_sva *handle;
597593
struct mm_struct *mm = domain->mm;
598594

599595
mutex_lock(&sva_lock);
600-
handle = __arm_smmu_sva_bind(dev, mm);
601-
if (IS_ERR(handle))
602-
ret = PTR_ERR(handle);
596+
ret = __arm_smmu_sva_bind(dev, mm);
603597
mutex_unlock(&sva_lock);
604598

605599
return ret;

0 commit comments

Comments
 (0)