diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-11-24 06:05:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 05:39:28 -0500 |
commit | 48ffae87e91346382790af10d793cba4d2e1d341 (patch) | |
tree | 5d6ccb79ea32925ab8e3792651177f99a4dcdf54 | |
parent | 54eed7ab1367f3d802ba516a60967e8547224a55 (diff) |
iommu/amd: Missing error code in amd_iommu_init_device()
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>
-rw-r--r-- | drivers/iommu/amd_iommu_v2.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index 594849a3a9be..f8ed8c95b685 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c | |||
@@ -805,8 +805,10 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids) | |||
805 | goto out_free_domain; | 805 | goto out_free_domain; |
806 | 806 | ||
807 | group = iommu_group_get(&pdev->dev); | 807 | group = iommu_group_get(&pdev->dev); |
808 | if (!group) | 808 | if (!group) { |
809 | ret = -EINVAL; | ||
809 | goto out_free_domain; | 810 | goto out_free_domain; |
811 | } | ||
810 | 812 | ||
811 | ret = iommu_attach_group(dev_state->domain, group); | 813 | ret = iommu_attach_group(dev_state->domain, group); |
812 | if (ret != 0) | 814 | if (ret != 0) |