]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iommu: Use right function to get group for device
authorLu Baolu <baolu.lu@linux.intel.com>
Tue, 21 May 2019 07:27:35 +0000 (15:27 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iommu/iommu.c

index 51a9394b0d9b1be246f4a9584bd782486898cedd..0598467159916906f2b10e034228d5944396436f 100644 (file)
@@ -1870,9 +1870,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);