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

Commit 69b00796 authored by John Keeping's avatar John Keeping Committed by Mark Yao
Browse files

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: default avatarJohn Keeping <john@metanate.com>
parent aa1ac27f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
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;