[PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting

Anusha Srivatsa posted 4 patches 6 months, 2 weeks ago
[PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
Posted by Anusha Srivatsa 6 months, 2 weeks ago
Put the panel reference back when driver is no
longer using it.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/bridge/samsung-dsim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index 0014c497e3fe7d8349a119dbdda30d65d816cccf..3667855ff0d6d1b608c579573de657af7fd14388 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1748,6 +1748,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
 			dsi->out_bridge = ERR_PTR(-EINVAL);
 	}
 
+	drm_panel_put(panel);
 	of_node_put(remote);
 
 	if (IS_ERR(dsi->out_bridge)) {

-- 
2.48.1
Re: [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
Posted by Maxime Ripard 6 months, 2 weeks ago
On Wed, Jun 04, 2025 at 10:45:11PM -0500, Anusha Srivatsa wrote:
> Put the panel reference back when driver is no
> longer using it.
> 
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
> ---
>  drivers/gpu/drm/bridge/samsung-dsim.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 0014c497e3fe7d8349a119dbdda30d65d816cccf..3667855ff0d6d1b608c579573de657af7fd14388 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1748,6 +1748,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
>  			dsi->out_bridge = ERR_PTR(-EINVAL);
>  	}
>  
> +	drm_panel_put(panel);
>  	of_node_put(remote);
>  
>  	if (IS_ERR(dsi->out_bridge)) {

Explaining in your commit log why you think it's a good idea to put it
there would be really nice. In particular, it looks super odd to me that
you would put the panel reference in attach.

Also, your patch doesn't work, and you have a reference inbalance. You
have one taken by the panel driver, put in remove. You have one in
drm_panel_add, put in drm_panel_remove. Which reference do you put here?

This applies to your other patches too.

Maxime