OSDN Git Service

iommu/amd: Missing error code in amd_iommu_init_device()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 24 Nov 2016 11:05:44 +0000 (14:05 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:28 +0000 (11:39 +0100)
commit 24c790fbf5d8f54c8c82979db11edea8855b74bf upstream.

We should set "ret" to -EINVAL if iommu_group_get() fails.

Fixes: 55c99a4dc50f ("iommu/amd: Use iommu_attach_group()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/amd_iommu_v2.c

index 594849a..f8ed8c9 100644 (file)
@@ -805,8 +805,10 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)
                goto out_free_domain;
 
        group = iommu_group_get(&pdev->dev);
-       if (!group)
+       if (!group) {
+               ret = -EINVAL;
                goto out_free_domain;
+       }
 
        ret = iommu_attach_group(dev_state->domain, group);
        if (ret != 0)