mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] drm: Fix resource leaks on power-on failure paths
@ 2026-11-04  9:33 Tang Bin
  2026-11-04  9:33 ` [PATCH 1/3] drm/panel: renesas-r61307: disable vcc on iovcc enable failure Tang Bin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tang Bin @ 2026-11-04  9:33 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Andrzej Hajda, Robert Foss, David Airlie,
	Simona Vetter, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Luca Ceresoli
  Cc: dri-devel, linux-kernel, Tang Bin

This series fixes similar resource leak bugs in DRM panel and bridge
drivers.

In all three drivers, a primary resource (regulator or clock) is enabled
first, followed by a secondary resource. If enabling the secondary
resource fails, the drivers return directly without disabling the first
one. Because these resources are reference-counted and the matching
power-off/unprepare callbacks won't be triggered on failure, the
reference counts leak.

Patch 1 and 2 use goto labels to rollback the regulators. Patch 3 is a
void function and explicitly disables the leaked regulator on failure.

Tang Bin (3):
  drm/panel: renesas-r61307: disable vcc on iovcc enable failure
  drm/panel: otm8009a: disable supply on init_sequence failure
  drm/bridge: anx6345: disable dvdd12 on dvdd25 enable failure

 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 1 +
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   | 6 +++++-
 drivers/gpu/drm/panel/panel-renesas-r61307.c       | 6 +++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.52.0.windows.1




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

* [PATCH 1/3] drm/panel: renesas-r61307: disable vcc on iovcc enable failure
  2026-11-04  9:33 [PATCH 0/3] drm: Fix resource leaks on power-on failure paths Tang Bin
@ 2026-11-04  9:33 ` Tang Bin
  2026-11-04  9:33 ` [PATCH 2/3] drm/panel: otm8009a: disable supply on init_sequence failure Tang Bin
  2026-11-04  9:33 ` [PATCH 3/3] drm/bridge: anx6345: disable dvdd12 on dvdd25 enable failure Tang Bin
  2 siblings, 0 replies; 4+ messages in thread
From: Tang Bin @ 2026-11-04  9:33 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Andrzej Hajda, Robert Foss, David Airlie,
	Simona Vetter, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Luca Ceresoli
  Cc: dri-devel, linux-kernel, Tang Bin

renesas_r61307_prepare() enables vcc_supply then iovcc_supply; on iovcc
failure it returns directly, leaking vcc_supply (the matching unprepare
disables both). Route through a disable_vcc label.

Fixes: cb6c01ead1eb ("drm: panel: Add support for Renesas R61307 based MIPI DSI panel")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/gpu/drm/panel/panel-renesas-r61307.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-renesas-r61307.c b/drivers/gpu/drm/panel/panel-renesas-r61307.c
index 53556452e..0aed970d8 100644
--- a/drivers/gpu/drm/panel/panel-renesas-r61307.c
+++ b/drivers/gpu/drm/panel/panel-renesas-r61307.c
@@ -100,7 +100,7 @@ static int renesas_r61307_prepare(struct drm_panel *panel)
 	ret = regulator_enable(priv->iovcc_supply);
 	if (ret) {
 		dev_err(dev, "failed to enable iovcc power supply\n");
-		return ret;
+		goto disable_vcc;
 	}
 
 	usleep_range(2000, 3000);
@@ -108,6 +108,10 @@ static int renesas_r61307_prepare(struct drm_panel *panel)
 	renesas_r61307_reset(priv);
 
 	return 0;
+
+disable_vcc:
+	regulator_disable(priv->vcc_supply);
+	return ret;
 }
 
 static int renesas_r61307_enable(struct drm_panel *panel)
-- 
2.52.0.windows.1




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

* [PATCH 2/3] drm/panel: otm8009a: disable supply on init_sequence failure
  2026-11-04  9:33 [PATCH 0/3] drm: Fix resource leaks on power-on failure paths Tang Bin
  2026-11-04  9:33 ` [PATCH 1/3] drm/panel: renesas-r61307: disable vcc on iovcc enable failure Tang Bin
@ 2026-11-04  9:33 ` Tang Bin
  2026-11-04  9:33 ` [PATCH 3/3] drm/bridge: anx6345: disable dvdd12 on dvdd25 enable failure Tang Bin
  2 siblings, 0 replies; 4+ messages in thread
From: Tang Bin @ 2026-11-04  9:33 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Andrzej Hajda, Robert Foss, David Airlie,
	Simona Vetter, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Luca Ceresoli
  Cc: dri-devel, linux-kernel, Tang Bin

otm8009a_prepare() enables ctx->supply then runs otm8009a_init_sequence();
on init failure it returns directly, leaking the supply (unprepare disables
it). Route through a disable_supply label.

Fixes: f0a5bb9803a9 ("drm/panel: Add support for OTM8009A panel driver")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 130520558..49cac3012 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -281,11 +281,15 @@ static int otm8009a_prepare(struct drm_panel *panel)
 
 	ret = otm8009a_init_sequence(ctx);
 	if (ret)
-		return ret;
+		goto disable_supply;
 
 	ctx->prepared = true;
 
 	return 0;
+
+disable_supply:
+	regulator_disable(ctx->supply);
+	return ret;
 }
 
 static int otm8009a_enable(struct drm_panel *panel)
-- 
2.52.0.windows.1




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

* [PATCH 3/3] drm/bridge: anx6345: disable dvdd12 on dvdd25 enable failure
  2026-11-04  9:33 [PATCH 0/3] drm: Fix resource leaks on power-on failure paths Tang Bin
  2026-11-04  9:33 ` [PATCH 1/3] drm/panel: renesas-r61307: disable vcc on iovcc enable failure Tang Bin
  2026-11-04  9:33 ` [PATCH 2/3] drm/panel: otm8009a: disable supply on init_sequence failure Tang Bin
@ 2026-11-04  9:33 ` Tang Bin
  2 siblings, 0 replies; 4+ messages in thread
From: Tang Bin @ 2026-11-04  9:33 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Andrzej Hajda, Robert Foss, David Airlie,
	Simona Vetter, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Luca Ceresoli
  Cc: dri-devel, linux-kernel, Tang Bin

anx6345_power_on() enables dvdd12 then dvdd25; on dvdd25 failure it returns
directly (void function), leaking dvdd12 (poweroff disables both). Disable
dvdd12 before returning.

Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
index 407834a03..f84427eae 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -294,6 +294,7 @@ static void anx6345_poweron(struct anx6345 *anx6345)
 	if (err) {
 		DRM_ERROR("Failed to enable dvdd25 regulator: %d\n",
 			  err);
+		regulator_disable(anx6345->dvdd12);
 		return;
 	}
 
-- 
2.52.0.windows.1




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

end of thread, other threads:[~2026-11-04  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04  9:33 [PATCH 0/3] drm: Fix resource leaks on power-on failure paths Tang Bin
2026-11-04  9:33 ` [PATCH 1/3] drm/panel: renesas-r61307: disable vcc on iovcc enable failure Tang Bin
2026-11-04  9:33 ` [PATCH 2/3] drm/panel: otm8009a: disable supply on init_sequence failure Tang Bin
2026-11-04  9:33 ` [PATCH 3/3] drm/bridge: anx6345: disable dvdd12 on dvdd25 enable failure Tang Bin

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®