summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2016-04-05 14:50:32 +0100
committerMark Yao <mark.yao@rock-chips.com>2016-05-03 14:11:22 +0800
commit69b007968e7519cf1e44920f4578054c9e0fbdc3 (patch)
tree00bcee6f4c3a1737b9b4f45fef42344b40f41a62 /drivers/gpu/drm/rockchip/rockchip_drm_drv.c
parentaa1ac27f48de0ed94d5a104e15b5ab62b5deb236 (diff)
drm/rockchip: don't leak iommu mapping
arm_iommu_attach_device() takes its own reference to the mapping we give it. Since we do not keep a reference to the mapping ourselves, we must release it before returning. Also fix the error path, which fails to release the mapping if it has called arm_iommu_detach_device() since that clears archdata.mapping. Signed-off-by: John Keeping <john@metanate.com>
Diffstat (limited to 'drivers/gpu/drm/rockchip/rockchip_drm_drv.c')
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_drv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 7695c791ad95..1e2d88bdd9f7 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -218,6 +218,7 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
if (ret)
goto err_vblank_cleanup;
+ arm_iommu_release_mapping(mapping);
return 0;
err_vblank_cleanup:
drm_vblank_cleanup(drm_dev);
@@ -228,7 +229,7 @@ err_unbind:
err_detach_device:
arm_iommu_detach_device(dev);
err_release_mapping:
- arm_iommu_release_mapping(dev->archdata.mapping);
+ arm_iommu_release_mapping(mapping);
err_config_cleanup:
drm_mode_config_cleanup(drm_dev);
drm_dev->dev_private = NULL;