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

Commit f6717d72 authored by Tomasz Figa's avatar Tomasz Figa Committed by Joerg Roedel
Browse files

iommu/rockchip: Fix error handling in attach



Currently if the driver encounters an error while attaching device, it
will leave the IOMMU in an inconsistent state. Even though it shouldn't
really happen in reality, let's just add proper error path to keep
things consistent.

Signed-off-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent d0b912bd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -824,7 +824,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,

	ret = rk_iommu_force_reset(iommu);
	if (ret)
		return ret;
		goto out_disable_stall;

	iommu->domain = domain;

@@ -837,7 +837,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,

	ret = rk_iommu_enable_paging(iommu);
	if (ret)
		return ret;
		goto out_disable_stall;

	spin_lock_irqsave(&rk_domain->iommus_lock, flags);
	list_add_tail(&iommu->node, &rk_domain->iommus);
@@ -845,9 +845,9 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,

	dev_dbg(dev, "Attached to iommu domain\n");

out_disable_stall:
	rk_iommu_disable_stall(iommu);

	return 0;
	return ret;
}

static void rk_iommu_detach_device(struct iommu_domain *domain,