aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/arm-smmu.c
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2015-11-20 16:56:18 +0800
committerWill Deacon <will.deacon@arm.com>2015-12-17 12:05:33 +0000
commit9a4a9d8c34bc0b0102e8a9dd67ee3910b0bfaeb4 (patch)
treed3f00b4266cfbe5cc38473296e206c07d5e91159 /drivers/iommu/arm-smmu.c
parentiommu/arm-smmu: Use incoming shareability attributes in bypass mode (diff)
downloadlinux-dev-9a4a9d8c34bc0b0102e8a9dd67ee3910b0bfaeb4.tar.xz
linux-dev-9a4a9d8c34bc0b0102e8a9dd67ee3910b0bfaeb4.zip
iommu/arm-smmu: Correct group reference count
The basic flow for add a device: arm_smmu_add_device |->iommu_group_get_for_dev |->iommu_group_get return group; (1) |->ops->device_group : Init/increase reference count to/by 1. |->iommu_group_add_device : Increase reference count by 1. return group (2) |->return 0; Since we are adding one device, the flow is (2) and the group reference count will be increased by 2. So, we need to add iommu_group_put at the end of arm_smmu_add_device to decrease the count by 1. Also take the failure path into consideration when fail to add a device. Signed-off-by: Peng Fan <van.freenix@gmail.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/arm-smmu.c')
-rw-r--r--drivers/iommu/arm-smmu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 1ce4b85d5216..6ed169bcb39d 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1355,6 +1355,7 @@ static int arm_smmu_add_device(struct device *dev)
if (IS_ERR(group))
return PTR_ERR(group);
+ iommu_group_put(group);
return 0;
}