Commit 537e4a32 authored by Lu Baolu's avatar Lu Baolu Committed by Kleber Sacilotto de Souza

iommu: Use right function to get group for device

BugLink: https://bugs.launchpad.net/bugs/1864773

[ Upstream commit 57274ea2 ]

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: d290f1e7 ("iommu: Introduce iommu_request_dm_for_dev()")
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent f9dcccaa
...@@ -1594,9 +1594,9 @@ int iommu_request_dm_for_dev(struct device *dev) ...@@ -1594,9 +1594,9 @@ int iommu_request_dm_for_dev(struct device *dev)
int ret; int ret;
/* Device must already be in a group before calling this function */ /* Device must already be in a group before calling this function */
group = iommu_group_get_for_dev(dev); group = iommu_group_get(dev);
if (IS_ERR(group)) if (!group)
return PTR_ERR(group); return -EINVAL;
mutex_lock(&group->mutex); mutex_lock(&group->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment