iommu/arm-smmu-v3: Return -EBUSY when trying to re-add a device
authorWill Deacon <will@kernel.org>
Wed, 15 Jan 2020 15:35:16 +0000 (15:35 +0000)
committerWill Deacon <will@kernel.org>
Wed, 15 Jan 2020 16:30:28 +0000 (16:30 +0000)
commit92c1d360dcda0ebd49253c0899bfeeb117be91fe
treec292d09a111905911bb616e66f72770a1e7c55c8
parenta2be6218e649fb6e444e468dae5d177eea64d328
iommu/arm-smmu-v3: Return -EBUSY when trying to re-add a device

Although we WARN in arm_smmu_add_device() if the device being added has
been added already without a subsequent call to arm_smmu_remove_device(),
we still continue half-heartedly, initialising the stream-table for any
new StreamIDs that may have magically appeared and re-establishing device
links that should still be there from last time.

Given that calling ->add_device() twice without removing the device in the
meantime is indicative of an error in the caller, just return -EBUSY after
warning.

Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Jean Philippe-Brucker <jean-philippe@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm-smmu-v3.c