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

Commit fff2fd1a authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Joerg Roedel
Browse files

iommu/exynos: Properly release device from the default domain in ->remove



IOMMU core doesn't detach device from the default domain before calling
->iommu_remove_device, so check that and do the proper cleanup or
warn if device is still attached to non-default domain.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 0bd5a0c7
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1242,9 +1242,21 @@ static int exynos_iommu_add_device(struct device *dev)

static void exynos_iommu_remove_device(struct device *dev)
{
	struct exynos_iommu_owner *owner = dev->archdata.iommu;

	if (!has_sysmmu(dev))
		return;

	if (owner->domain) {
		struct iommu_group *group = iommu_group_get(dev);

		if (group) {
			WARN_ON(owner->domain !=
				iommu_group_default_domain(group));
			exynos_iommu_detach_device(owner->domain, dev);
			iommu_group_put(group);
		}
	}
	iommu_group_remove_device(dev);
}