Subject: Re: [PATCH RESEND] drm/tegra: dc: fix reference leak in tegra_dc_couple()

From: Mikko Perttunen <[email-masked]>
Date: Thu, 23 Oct 2025 13:32:56 +0900

On Wednesday, October 22, 2025 8:47 PM Ma Ke wrote:
> driver_find_device() calls get_device() to increment the reference
> count once a matching device is found, but there is no put_device() to
> balance the reference count. To avoid reference count leakage, add
> put_device() to decrease the reference count.
> 
> Found by code review.
> 
> Cc: [email-masked]
> Fixes: a31500fe7055 ("drm/tegra: dc: Restore coupling of display controllers")
> Signed-off-by: Ma Ke <[email-masked]>
> ---
>  drivers/gpu/drm/tegra/dc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 59d5c1ba145a..6c84bd69b11f 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -3148,6 +3148,7 @@ static int tegra_dc_couple(struct tegra_dc *dc)
>  		dc->client.parent = &parent->client;
>  
>  		dev_dbg(dc->dev, "coupled to %s\n", dev_name(companion));
> +		put_device(companion);
>  	}
>  
>  	return 0;
> 

Acked-by: Mikko Perttunen <[email-masked]>

---

From: Ma Ke <[email-masked]>
Date: Wed, 22 Oct 2025 19:47:20 +0800

Found by code review.

 
 
 	return 0;
-- 
2.17.1