summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorLu Baolu <baolu.lu@linux.intel.com>2019-05-21 15:27:35 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-27 14:50:51 +0100
commitf771e86b02301bf00c92aa87e9994d974414cab7 (patch)
treeaff234cf99935f7d432ec1362ff9d0337f42d106 /drivers/iommu/iommu.c
parent725a96b6f66eaea3d700b30f84c18c76eee404bd (diff)
downloadlinux-stable-f771e86b02301bf00c92aa87e9994d974414cab7.tar.gz
linux-stable-f771e86b02301bf00c92aa87e9994d974414cab7.tar.bz2
linux-stable-f771e86b02301bf00c92aa87e9994d974414cab7.zip
iommu: Use right function to get group for device
[ Upstream commit 57274ea25736496ee019a5c40479855b21888839 ] The iommu_group_get_for_dev() will allocate a group for a device if it isn't in any group. This isn't the use case in iommu_request_dm_for_dev(). Let's use iommu_group_get() instead. Fixes: d290f1e70d85a ("iommu: Introduce iommu_request_dm_for_dev()") Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index b82bec4224b9..00e1c908cd8e 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1900,9 +1900,9 @@ int iommu_request_dm_for_dev(struct device *dev)
int ret;
/* Device must already be in a group before calling this function */
- group = iommu_group_get_for_dev(dev);
- if (IS_ERR(group))
- return PTR_ERR(group);
+ group = iommu_group_get(dev);
+ if (!group)
+ return -EINVAL;
mutex_lock(&group->mutex);