summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/rockchip-iommu.c
diff options
context:
space:
mode:
authorTomasz Figa <tfiga@chromium.org>2018-03-23 08:38:04 +0100
committerJoerg Roedel <jroedel@suse.de>2018-03-29 12:22:25 +0200
commitf6717d727c9a2b0742ac23234a347db0d3ad718a (patch)
treecb713dbecdf79aa808e49c7635d4c121a914b6d7 /drivers/iommu/rockchip-iommu.c
parentiommu/rockchip: Request irqs in rk_iommu_probe() (diff)
downloadlinux-f6717d727c9a2b0742ac23234a347db0d3ad718a.tar.xz
linux-f6717d727c9a2b0742ac23234a347db0d3ad718a.zip
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: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/rockchip-iommu.c')
-rw-r--r--drivers/iommu/rockchip-iommu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index ec3ff936aa60..5cbd5ceeb039 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -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,