Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3170447c authored by Varun Sethi's avatar Varun Sethi Committed by Joerg Roedel
Browse files

iommu/fsl: Fix the error condition during iommu group



Earlier PTR_ERR was being returned even if group was set to null.
Now, we explicitly set an ERR_PTR value in case the group  pointer is
NULL.

Signed-off-by: default avatarVarun Sethi <Varun.Sethi@freescale.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 75f0e461
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1037,12 +1037,15 @@ root_bus:
			group = get_shared_pci_device_group(pdev);
	}

	if (!group)
		group = ERR_PTR(-ENODEV);

	return group;
}

static int fsl_pamu_add_device(struct device *dev)
{
	struct iommu_group *group = NULL;
	struct iommu_group *group = ERR_PTR(-ENODEV);
	struct pci_dev *pdev;
	const u32 *prop;
	int ret, len;
@@ -1065,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev)
			group = get_device_iommu_group(dev);
	}

	if (!group || IS_ERR(group))
	if (IS_ERR(group))
		return PTR_ERR(group);

	ret = iommu_group_add_device(group, dev);