linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/rockchip: remove redundant statement
@ 2016-04-05 13:50 John Keeping
  2016-04-05 13:50 ` [PATCH 2/2] drm/rockchip: don't leak iommu mapping John Keeping
  2016-04-11  2:52 ` [PATCH 1/2] drm/rockchip: remove redundant statement Mark yao
  0 siblings, 2 replies; 4+ messages in thread
From: John Keeping @ 2016-04-05 13:50 UTC (permalink / raw)
  To: Mark Yao; +Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel

The call to arm_iommu_detach_device() on the previous line sets
dev->archdata.mapping to NULL so this call is always a no-op.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index f556a8f..7695c79 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -244,7 +244,6 @@ static int rockchip_drm_unload(struct drm_device *drm_dev)
 	drm_kms_helper_poll_fini(drm_dev);
 	component_unbind_all(dev, drm_dev);
 	arm_iommu_detach_device(dev);
-	arm_iommu_release_mapping(dev->archdata.mapping);
 	drm_mode_config_cleanup(drm_dev);
 	drm_dev->dev_private = NULL;
 
-- 
2.8.0.rc4.238.g874082a

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/rockchip: don't leak iommu mapping
  2016-04-05 13:50 [PATCH 1/2] drm/rockchip: remove redundant statement John Keeping
@ 2016-04-05 13:50 ` John Keeping
  2016-04-11  2:52   ` Mark yao
  2016-04-11  2:52 ` [PATCH 1/2] drm/rockchip: remove redundant statement Mark yao
  1 sibling, 1 reply; 4+ messages in thread
From: John Keeping @ 2016-04-05 13:50 UTC (permalink / raw)
  To: Mark Yao; +Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel

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>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 7695c79..1e2d88b 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;
-- 
2.8.0.rc4.238.g874082a

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/rockchip: remove redundant statement
  2016-04-05 13:50 [PATCH 1/2] drm/rockchip: remove redundant statement John Keeping
  2016-04-05 13:50 ` [PATCH 2/2] drm/rockchip: don't leak iommu mapping John Keeping
@ 2016-04-11  2:52 ` Mark yao
  1 sibling, 0 replies; 4+ messages in thread
From: Mark yao @ 2016-04-11  2:52 UTC (permalink / raw)
  To: John Keeping; +Cc: linux-arm-kernel, linux-rockchip, dri-devel, linux-kernel

On 2016年04月05日 21:50, John Keeping wrote:
> The call to arm_iommu_detach_device() on the previous line sets
> dev->archdata.mapping to NULL so this call is always a no-op.
>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index f556a8f..7695c79 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -244,7 +244,6 @@ static int rockchip_drm_unload(struct drm_device *drm_dev)
>   	drm_kms_helper_poll_fini(drm_dev);
>   	component_unbind_all(dev, drm_dev);
>   	arm_iommu_detach_device(dev);
> -	arm_iommu_release_mapping(dev->archdata.mapping);
>   	drm_mode_config_cleanup(drm_dev);
>   	drm_dev->dev_private = NULL;
>   
Applied to my drm-fixes

Thanks.:-)

-- 
Mark Yao


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] drm/rockchip: don't leak iommu mapping
  2016-04-05 13:50 ` [PATCH 2/2] drm/rockchip: don't leak iommu mapping John Keeping
@ 2016-04-11  2:52   ` Mark yao
  0 siblings, 0 replies; 4+ messages in thread
From: Mark yao @ 2016-04-11  2:52 UTC (permalink / raw)
  To: John Keeping; +Cc: linux-arm-kernel, linux-rockchip, dri-devel, linux-kernel

On 2016年04月05日 21:50, John Keeping wrote:
> 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>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 7695c79..1e2d88b 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;
Applied to my drm-fixes

Thanks.

-- 
Mark Yao


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-11  2:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 13:50 [PATCH 1/2] drm/rockchip: remove redundant statement John Keeping
2016-04-05 13:50 ` [PATCH 2/2] drm/rockchip: don't leak iommu mapping John Keeping
2016-04-11  2:52   ` Mark yao
2016-04-11  2:52 ` [PATCH 1/2] drm/rockchip: remove redundant statement Mark yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).