Re: [PATCH] media: platform: mtk-mdp3: Fix SCP device refcounting

From: Johan Hovold

Date: Mon Jul 06 2026 - 03:26:19 EST


On Sun, Jul 05, 2026 at 01:31:19AM +0800, Guangshuo Li wrote:
> mdp_probe() first tries to get the SCP handle with scp_get(). When that
> fails, it falls back to looking up the SCP platform device with
> __get_pdev_by_id() and then reads its driver data.
>
> The fallback lookup returns the platform device with a reference, just
> like scp_get() does. However, the fallback path currently drops that
> reference immediately after platform_get_drvdata(). The driver later
> still calls scp_put(mdp->scp) unconditionally from the probe error path
> and from mdp_video_device_release(), which drops the SCP device
> reference again.
>
> Keep the fallback reference until the existing scp_put() call, so that
> the fallback path follows the same ownership rules as the scp_get()
> path.

Thanks for catching that.

> Fixes: 8f6f3aa21517 ("media: platform: mtk-mdp3: fix device leaks at probe")

This one should also go to stable:

Cc: stable@xxxxxxxxxxxxxxx

> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>

Reviewed-by: Johan Hovold <johan@xxxxxxxxxx>

Johan