public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: samsung-dsim: fix TE GPIO ownership
@ 2026-06-04 11:46 Guangshuo Li
  2026-06-04 20:32 ` Claude review: " Claude Code Review Bot
  2026-06-04 20:32 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-06-04 11:46 UTC (permalink / raw)
  To: Inki Dae, Jagan Teki, Marek Szyprowski, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Marek Vasut,
	dri-devel, linux-kernel
  Cc: Guangshuo Li

samsung_dsim_register_te_irq() acquires the TE GPIO with
devm_gpiod_get_optional(), but the descriptor is released manually in the
request_threaded_irq() error path and in samsung_dsim_unregister_te_irq().
The devres entry remains registered and will release the same descriptor
again when the device is detached.

Use the non-managed gpiod_get_optional() helper instead, so the GPIO
descriptor lifetime matches the existing manual cleanup paths. Also clear
dsi->te_gpio after each gpiod_put() to avoid leaving a stale descriptor
pointer around if the host is attached again.

Fixes: e7447128ca4a ("drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/gpu/drm/bridge/samsung-dsim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index c3eb437ef1b0..2299b7dc0c04 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1862,7 +1862,7 @@ static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, struct device
 	int te_gpio_irq;
 	int ret;
 
-	dsi->te_gpio = devm_gpiod_get_optional(dev, "te", GPIOD_IN);
+	dsi->te_gpio = gpiod_get_optional(dev, "te", GPIOD_IN);
 	if (!dsi->te_gpio)
 		return 0;
 	else if (IS_ERR(dsi->te_gpio))
@@ -1875,6 +1875,7 @@ static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, struct device
 	if (ret) {
 		dev_err(dsi->dev, "request interrupt failed with %d\n", ret);
 		gpiod_put(dsi->te_gpio);
+		dsi->te_gpio = NULL;
 		return ret;
 	}
 
@@ -1886,6 +1887,7 @@ static void samsung_dsim_unregister_te_irq(struct samsung_dsim *dsi)
 	if (dsi->te_gpio) {
 		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);
 		gpiod_put(dsi->te_gpio);
+		dsi->te_gpio = NULL;
 	}
 }
 
-- 
2.43.0


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

end of thread, other threads:[~2026-06-04 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 11:46 [PATCH] drm/bridge: samsung-dsim: fix TE GPIO ownership Guangshuo Li
2026-06-04 20:32 ` Claude review: " Claude Code Review Bot
2026-06-04 20:32 ` Claude Code Review Bot

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