* [PATCH] drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable()
@ 2026-09-16 10:04 Wentao Liang
2026-09-16 14:54 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16 10:04 UTC (permalink / raw)
To: Laurent.pinchart
Cc: airlied, andrzej.hajda, architt, bbrezillon, dri-devel, eric,
jernej.skrabec, jonas, linux-kernel, maarten.lankhorst, mripard,
neil.armstrong, rfoss, simona, tzimmermann, Wentao Liang, stable
cdns_dsi_bridge_atomic_pre_enable() resumes the DSI controller with
pm_runtime_get_sync() and returns early with a WARN_ON() 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: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 0dd85e26248c..fca4528edfa6 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -733,8 +733,10 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
* enable their streams.
*/
- if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
+ if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) {
+ pm_runtime_put_noidle(dsi->base.dev);
return;
+ }
new_bridge_state = drm_atomic_get_new_bridge_state(state, bridge);
if (WARN_ON(!new_bridge_state))
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable()
2026-09-16 10:04 [PATCH] drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable() Wentao Liang
@ 2026-09-16 14:54 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2026-09-16 14:54 UTC (permalink / raw)
To: Wentao Liang
Cc: airlied, andrzej.hajda, architt, bbrezillon, dri-devel, eric,
jernej.skrabec, jonas, linux-kernel, maarten.lankhorst, mripard,
neil.armstrong, rfoss, simona, tzimmermann, stable
On Wed, Sep 16, 2026 at 10:04:05AM +0000, Wentao Liang wrote:
> cdns_dsi_bridge_atomic_pre_enable() resumes the DSI controller with
> pm_runtime_get_sync() and returns early with a WARN_ON() 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: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index 0dd85e26248c..fca4528edfa6 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -733,8 +733,10 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> * enable their streams.
> */
>
> - if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
> + if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) {
> + pm_runtime_put_noidle(dsi->base.dev);
> return;
> + }
Anything wrong with pm_runtime_resume_and_get() ?
>
> new_bridge_state = drm_atomic_get_new_bridge_state(state, bridge);
> if (WARN_ON(!new_bridge_state))
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-16 14:54 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:04 [PATCH] drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable() Wentao Liang
2026-09-16 14:54 ` Laurent Pinchart
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®