From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Alexander Stein <alexander.stein@ew.tq-group.com>,
Inki Dae <inki.dae@samsung.com>,
Jagan Teki <jagan@amarulasolutions.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>
Subject: Re: [PATCH] drm/bridge: samsung-dsim: fix TE GPIO ownership
Date: Mon, 8 Jun 2026 12:20:16 +0200 [thread overview]
Message-ID: <f44cd26b-782b-493f-b298-482629780385@samsung.com> (raw)
In-Reply-To: <7255371.MhkbZ0Pkbq@steina-w>
On 05.06.2026 09:51, Alexander Stein wrote:
> 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?
Not really. The dev pointer here is not the device that the $subject driver binds to, so using devm_* interface is a bit fragile. Similar issue was fixed long time ago by commit fedc89821990 ("drm/exynos: Search for TE-gpio in DSI panel's node"). I would prefer explicitly use non-devm api for it.
For the initial patch:
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> 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;
>> }
>> }
>>
>>
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
prev parent reply other threads:[~2026-06-08 10:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 11:46 Guangshuo Li
2026-06-05 7:51 ` Alexander Stein
2026-06-08 10:20 ` Marek Szyprowski [this message]
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=f44cd26b-782b-493f-b298-482629780385@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=alexander.stein@ew.tq-group.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=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
all inboxes | Powered by JetHome®