From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A62714071EB for ; Mon, 8 Jun 2026 10:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780914024; cv=none; b=rhEGnTXVcr88e40clufv3vn9hPXFyXH1hg/6sQ0b2/Wg9xVHsOiqhLhj6ymuEsBHihDKhD9jzPR30y8B16PFGErIpSmam5Tfv4dZXjSjuPm57aW4OdVBsjnsOcUgOMp+oRhjk+aFMkSmgb7ic8iVdsvdb9yHG3aE3RdLcYOv7o0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780914024; c=relaxed/simple; bh=tLLqqsqYB1BQ5iNQpPgfzdq0JLZmrwxS5ajSpNyDbrs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=ng8JbR9+AgLe11LyqOpXEKhbCCU+fHKoLEqV/zmheEcPzgO9+jx+1BOoTScGbQRkx1batijzGwLHZMDzPFwEFdP2dLG8AKuPXaiGGZTB1yTlqHlgvUR4ce+5/UHWkbVAOxZTbnym21JXSw4CGQWrAho9Cnws0k1TSXx0vLxYYeI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=jxABCkWS; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="jxABCkWS" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20260608102019euoutp02c42e4fd50033ad5cc57f8fae706226e1~3E92LAIIv2675026750euoutp02G for ; Mon, 8 Jun 2026 10:20:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20260608102019euoutp02c42e4fd50033ad5cc57f8fae706226e1~3E92LAIIv2675026750euoutp02G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1780914019; bh=MwX2QwB3+58Yda8r88VDRC3U2MfXiXWf69QmRRXsBQc=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=jxABCkWSyUh7FsGKgTYBpiU3QpLMDlM8fod8Cuta/WeqjjSPa/zm0+6C9rbnt83// 26XV1QcQsi7S5V1kmCJyMx6GL+vC3O2lj7Zx2Q8yq/vVuIflRwZQ18vaqGsagf4djN o4wsaQry54j2ikTdpgRxWm2d7Y4p1ze0KnzdQQgs= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20260608102019eucas1p2d2d5aaeac17e5fe86a6e77b5f214d9c5~3E91nfe0Y0110601106eucas1p2b; Mon, 8 Jun 2026 10:20:19 +0000 (GMT) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20260608102018eusmtip10272072f4c7e9dda37c4e1c049edc977~3E90jKOr91778017780eusmtip1S; Mon, 8 Jun 2026 10:20:18 +0000 (GMT) Message-ID: Date: Mon, 8 Jun 2026 12:20:16 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Betterbird (Windows) Subject: Re: [PATCH] drm/bridge: samsung-dsim: fix TE GPIO ownership To: Alexander Stein , Inki Dae , Jagan Teki , 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@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Content-Language: en-US From: Marek Szyprowski In-Reply-To: <7255371.MhkbZ0Pkbq@steina-w> Content-Transfer-Encoding: 7bit X-CMS-MailID: 20260608102019eucas1p2d2d5aaeac17e5fe86a6e77b5f214d9c5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20260605075148eucas1p1f6de1f1b3c9e063bc4e803da73cb2221 X-EPHeader: CA X-CMS-RootMailID: 20260605075148eucas1p1f6de1f1b3c9e063bc4e803da73cb2221 References: <20260604114604.1422184-1-lgs201920130244@gmail.com> <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 >> Fixes: e7447128ca4a ("drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge") >> Signed-off-by: Guangshuo Li >> --- >> 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