mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: microchip-lvds: Fix runtime PM leak in mchp_lvds_enable()
@ 2026-09-16 10:19 Wentao Liang
  2026-09-17 11:06 ` Manikandan.M
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16 10:19 UTC (permalink / raw)
  To: Laurent.pinchart
  Cc: airlied, andrzej.hajda, dharma.b, dri-devel, hari.prasathge,
	jernej.skrabec, jonas, linux-kernel, lumag, maarten.lankhorst,
	manikandan.m, mripard, neil.armstrong, rfoss, simona,
	tzimmermann, Wentao Liang, stable

mchp_lvds_enable() resumes the device with pm_runtime_get_sync() and
returns early when the resume fails.  pm_runtime_get_sync() increments
the runtime PM usage count even when it fails, so returning without
dropping the reference leaks it and prevents the device from ever
suspending again once the error has been hit.

Drop the runtime PM reference with pm_runtime_put_noidle() on the
resume failure path before returning.

Fixes: 179b0769fc5f ("drm/bridge: add lvds controller support for sam9x7")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/bridge/microchip-lvds.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/microchip-lvds.c b/drivers/gpu/drm/bridge/microchip-lvds.c
index 9f4ff82bc6b4..b77ec6ae0a97 100644
--- a/drivers/gpu/drm/bridge/microchip-lvds.c
+++ b/drivers/gpu/drm/bridge/microchip-lvds.c
@@ -127,6 +127,7 @@ static void mchp_lvds_enable(struct drm_bridge *bridge)
 	ret = pm_runtime_get_sync(lvds->dev);
 	if (ret < 0) {
 		dev_err(lvds->dev, "failed to get pm runtime: %d\n", ret);
+		pm_runtime_put_noidle(lvds->dev);
 		return;
 	}
 
-- 
2.34.1


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

* Re: [PATCH] drm/bridge: microchip-lvds: Fix runtime PM leak in mchp_lvds_enable()
  2026-09-16 10:19 [PATCH] drm/bridge: microchip-lvds: Fix runtime PM leak in mchp_lvds_enable() Wentao Liang
@ 2026-09-17 11:06 ` Manikandan.M
  0 siblings, 0 replies; 2+ messages in thread
From: Manikandan.M @ 2026-09-17 11:06 UTC (permalink / raw)
  To: vulab, Laurent.pinchart
  Cc: airlied, andrzej.hajda, dharma.b, dri-devel, hari.prasathge,
	jernej.skrabec, jonas, linux-kernel, lumag, maarten.lankhorst,
	mripard, neil.armstrong, rfoss, simona, tzimmermann, stable

Hi Wentao Liang,

Thanks for the patch, and Sashiko's automated review is correct here — 
this needs rework.

pm_runtime_get_sync() bumps the usage count even on failure, so today 
that leaked reference is consumed by the put in _disable().Adding 
pm_runtime_put_noidle() on the error path makes the later unconditional 
pm_runtime_put() underflow the counter.

Also, as of v7.2 the function is mchp_lvds_atomic_enable(), so please 
rebase it on to the latest and update the subject/commit message.

On 9/16/26 3:49 PM, Wentao Liang wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> mchp_lvds_enable() resumes the device with pm_runtime_get_sync() and
> returns early when the resume fails.  pm_runtime_get_sync() increments
> the runtime PM usage count even when it fails, so returning without
> dropping the reference leaks it and prevents the device from ever
> suspending again once the error has been hit.
> 
> Drop the runtime PM reference with pm_runtime_put_noidle() on the
> resume failure path before returning.
> 
> Fixes: 179b0769fc5f ("drm/bridge: add lvds controller support for sam9x7")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>   drivers/gpu/drm/bridge/microchip-lvds.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/bridge/microchip-lvds.c b/drivers/gpu/drm/bridge/microchip-lvds.c
> index 9f4ff82bc6b4..b77ec6ae0a97 100644
> --- a/drivers/gpu/drm/bridge/microchip-lvds.c
> +++ b/drivers/gpu/drm/bridge/microchip-lvds.c
> @@ -127,6 +127,7 @@ static void mchp_lvds_enable(struct drm_bridge *bridge)
>          ret = pm_runtime_get_sync(lvds->dev);
>          if (ret < 0) {
>                  dev_err(lvds->dev, "failed to get pm runtime: %d\n", ret);
> +               pm_runtime_put_noidle(lvds->dev);
>                  return;
>          }
> 
> --
> 2.34.1
> 


-- 
Thanks and Regards,
Manikandan M.

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

end of thread, other threads:[~2026-09-17 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 10:19 [PATCH] drm/bridge: microchip-lvds: Fix runtime PM leak in mchp_lvds_enable() Wentao Liang
2026-09-17 11:06 ` Manikandan.M

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®