linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove()
@ 2021-03-23  0:56 Laurent Pinchart
  2021-03-23  0:56 ` [PATCH 2/2] drm: rcar-du: Shutdown the display on remove Laurent Pinchart
  2021-06-21 20:14 ` [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove() Kieran Bingham
  0 siblings, 2 replies; 4+ messages in thread
From: Laurent Pinchart @ 2021-03-23  0:56 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc

The reference to the drm_device that was acquired by
devm_drm_dev_alloc() is released automatically by the devres
infrastructure. It must not be released manually, as that causes a
reference underflow..

Fixes: ea6aae151887 ("drm: rcar-du: Embed drm_device in rcar_du_device")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 43de3d8686e8..2a06ec1cbefb 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -556,8 +556,6 @@ static int rcar_du_remove(struct platform_device *pdev)
 
 	drm_kms_helper_poll_fini(ddev);
 
-	drm_dev_put(ddev);
-
 	return 0;
 }
 
-- 
Regards,

Laurent Pinchart


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

* [PATCH 2/2] drm: rcar-du: Shutdown the display on remove
  2021-03-23  0:56 [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove() Laurent Pinchart
@ 2021-03-23  0:56 ` Laurent Pinchart
  2021-06-21 20:22   ` Kieran Bingham
  2021-06-21 20:14 ` [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove() Kieran Bingham
  1 sibling, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2021-03-23  0:56 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc

When the device is unbound from the driver (the DU being a platform
device, this occurs either when removing the DU module, or when
unbinding the device manually through sysfs), the display may be active.
Make sure it gets shut down.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 2a06ec1cbefb..9f1a3aad4dd7 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -553,6 +553,7 @@ static int rcar_du_remove(struct platform_device *pdev)
 	struct drm_device *ddev = &rcdu->ddev;
 
 	drm_dev_unregister(ddev);
+	drm_atomic_helper_shutdown(ddev);
 
 	drm_kms_helper_poll_fini(ddev);
 
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove()
  2021-03-23  0:56 [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove() Laurent Pinchart
  2021-03-23  0:56 ` [PATCH 2/2] drm: rcar-du: Shutdown the display on remove Laurent Pinchart
@ 2021-06-21 20:14 ` Kieran Bingham
  1 sibling, 0 replies; 4+ messages in thread
From: Kieran Bingham @ 2021-06-21 20:14 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: linux-renesas-soc

Hi Laurent,

On 23/03/2021 00:56, Laurent Pinchart wrote:
> The reference to the drm_device that was acquired by
> devm_drm_dev_alloc() is released automatically by the devres
> infrastructure. It must not be released manually, as that causes a
> reference underflow..
> 

Ouch. We need some tests on module load and unload somewhere...

I'm getting closer with infrastructure ...


> Fixes: ea6aae151887 ("drm: rcar-du: Embed drm_device in rcar_du_device")
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 43de3d8686e8..2a06ec1cbefb 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -556,8 +556,6 @@ static int rcar_du_remove(struct platform_device *pdev)
>  
>  	drm_kms_helper_poll_fini(ddev);
>  
> -	drm_dev_put(ddev);
> -
>  	return 0;
>  }
>  
> 

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

* Re: [PATCH 2/2] drm: rcar-du: Shutdown the display on remove
  2021-03-23  0:56 ` [PATCH 2/2] drm: rcar-du: Shutdown the display on remove Laurent Pinchart
@ 2021-06-21 20:22   ` Kieran Bingham
  0 siblings, 0 replies; 4+ messages in thread
From: Kieran Bingham @ 2021-06-21 20:22 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: linux-renesas-soc

Hi Laurent,

On 23/03/2021 00:56, Laurent Pinchart wrote:
> When the device is unbound from the driver (the DU being a platform
> device, this occurs either when removing the DU module, or when
> unbinding the device manually through sysfs), the display may be active.
> Make sure it gets shut down.

I bet this may be particularly true if there's a console on it.


> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 2a06ec1cbefb..9f1a3aad4dd7 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -553,6 +553,7 @@ static int rcar_du_remove(struct platform_device *pdev)
>  	struct drm_device *ddev = &rcdu->ddev;
>  
>  	drm_dev_unregister(ddev);
> +	drm_atomic_helper_shutdown(ddev);
>  
>  	drm_kms_helper_poll_fini(ddev);

There's a real mix of other drivers either calling
drm_kms_helper_poll_fini() before drm_atomic_helper_shutdown() or after,
so I'll assume that the sequencing here isn't terribly important (I hope).

So,

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

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

end of thread, other threads:[~2021-06-21 20:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23  0:56 [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove() Laurent Pinchart
2021-03-23  0:56 ` [PATCH 2/2] drm: rcar-du: Shutdown the display on remove Laurent Pinchart
2021-06-21 20:22   ` Kieran Bingham
2021-06-21 20:14 ` [PATCH 1/2] drm: rcar-du: Don't put reference to drm_device in rcar_du_remove() Kieran Bingham

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).