From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Inki Dae <inki.dae@samsung.com>,
Jagan Teki <jagan@amarulasolutions.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Marek Vasut <marex@denx.de>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Guangshuo Li <lgs201920130244@gmail.com>,
Guangshuo Li <lgs201920130244@gmail.com>
Subject: Re: [PATCH] drm/bridge: samsung-dsim: fix TE GPIO ownership
Date: Fri, 05 Jun 2026 09:51:21 +0200 [thread overview]
Message-ID: <7255371.MhkbZ0Pkbq@steina-w> (raw)
In-Reply-To: <20260604114604.1422184-1-lgs201920130244@gmail.com>
Am Donnerstag, 4. Juni 2026, 13:46:04 CEST schrieb 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.
Shouldn't you use devm_gpiod_put instead of gpiod_put?
Best regards,
Alexander
> 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;
> }
> }
>
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
next prev parent reply other threads:[~2026-06-05 7:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 11:46 [PATCH] drm/bridge: samsung-dsim: fix TE GPIO ownership Guangshuo Li
2026-06-05 7:51 ` Alexander Stein [this message]
2026-06-08 10:20 ` Marek Szyprowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7255371.MhkbZ0Pkbq@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marex@denx.de \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox