From nobody Sat Oct 4 06:29:31 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 AB0D01DF273 for ; Tue, 19 Aug 2025 09:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755596567; cv=none; b=Iru3Eu6nV3VdKghpHOn2WNaO7Ibt6+Pz4U9ORXdaOyCUfH6WqIN/ScmnlZJB8zOOfQCNERrPev/asAEf9CXV12Nw2vbPegplG/KtqMxD/9f332Rdkz2fgvSDXcYMafvfp+jJWnRk5D10SPA4WlQODXeZcsZwuKjSDGKVoxNXEns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755596567; c=relaxed/simple; bh=oBgHnl9exEXWTWzH77dkHQ9PKnz6enJdL62Q0xnTEAk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WRE3Zna7vO7Vl/HiH8Kqoy1iUMeE+tv91FyGGdy0oiQQzt8S73RYuCDyik5FB+y4puyQXhYjqhxuHxCvxwHGoY2P9JJowJwfIzx3US6LB28cCbEmnqUQCwO9Q32+C/rPagCbrCRG/jvwMdfQici0/B4iVO3uBcd0cS/EwHJ1joI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=0LQ22EOg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="0LQ22EOg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 83C6C1A0936; Tue, 19 Aug 2025 09:42:38 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5D13060697; Tue, 19 Aug 2025 09:42:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4FE601C229658; Tue, 19 Aug 2025 11:42:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1755596557; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Wa0v0I2WqdC2JdYUW2NKyiKEQHDcnZtT8SCNn2TfAc4=; b=0LQ22EOgk5GVpkH9IfifatUNtMldEUwsOiuSwTXpO7WVrMzhz2LvrxuF4ktPFKHsfwJ3N2 4oU3Zob9XF+EVOoduBCISazBkoeG5NLasDQk0eoDc98CwH9N98yn/lS5sEV8n0xakc2/R3 v4DjKhKa0aeNQQDKTpA1FcRBE+3nTiN1pkWyyai0lNbbZfJ8uc4s8jQo8qwIi5vbpSVKRY 7RhFusriqRJRSxk9g0Y/UHajnM9B1eNP7a1yPh4LemwA96JBQTbU+ICRsm+XSXBLqOLgqc BijX9x/V2fDtBO2HCI5XnSediPhSdDFDF14judjeVxJKJJ2ZJvUMcFAw6qTkYg== From: Luca Ceresoli Date: Tue, 19 Aug 2025 11:42:10 +0200 Subject: [PATCH v7 1/3] drm/debugfs: bridges_show: show refcount Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250819-drm-bridge-debugfs-removed-v7-1-970702579978@bootlin.com> References: <20250819-drm-bridge-debugfs-removed-v7-0-970702579978@bootlin.com> In-Reply-To: <20250819-drm-bridge-debugfs-removed-v7-0-970702579978@bootlin.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 Now that bridges are refcounted, exposing the refcount in debugfs can be useful. Suggested-by: Dmitry Baryshkov Signed-off-by: Luca Ceresoli Reviewed-by: Maxime Ripard --- Changes in v7: - rebased on current code: - code is in drm_bridge.c now - removed if (drm_bridge_is_refcounted(bridge)), refcounting is not optional This patch was added in v6. --- drivers/gpu/drm/drm_bridge.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 0688f936eeb69d9f5655f2b00de4a0843dc76088..36e0829d25c29457cff5da5fec9= 9646c74b6ad5a 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1477,6 +1477,9 @@ static void drm_bridge_debugfs_show_bridge(struct drm= _printer *p, unsigned int idx) { drm_printf(p, "bridge[%u]: %ps\n", idx, bridge->funcs); + + drm_printf(p, "\trefcount: %u\n", kref_read(&bridge->refcount)); + drm_printf(p, "\ttype: [%d] %s\n", bridge->type, drm_get_connector_type_name(bridge->type)); --=20 2.50.1 From nobody Sat Oct 4 06:29:31 2025 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 3B994319864 for ; Tue, 19 Aug 2025 09:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755597035; cv=none; b=LeDHtMMi1uwL307H8fkw3VqLek5snjLnMO6/z+N4BUPfphOswphmnZGbljzrJRFHzS48x8QXCjODkTKu6deqyGp19h2aHo5srbd5/9ThFSfgLvz5nMyKVqm3Jpt8G/HW96a4jgtmO0Od0R9bCYzSD3ADjcck5x4tZP8RbSypd4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755597035; c=relaxed/simple; bh=oOrB2b+SZBEGEr+b2nr2pqWEaC8gpvTrBVDGaPpOngg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JGnZHLblbpeTA2LrVVCEoMYN3aqKzLg9hZr/0634oEL4r0NQgQFypngsZTO3kRzWiFVJCloPVggAvN/pKLPg2aLpsjBCG4m+yOpMrUtjBTsdyD0K3RT2Sd5/rrSfk1PEQTAJHE7puTb+XCdszwy8+aZGNnGaeELMWW/4+XruiLA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=gAUWfWpg; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="gAUWfWpg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 66F98C6B3AC; Tue, 19 Aug 2025 09:42:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E6B0B60697; Tue, 19 Aug 2025 09:42:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C5D7F1C22A2DF; Tue, 19 Aug 2025 11:42:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1755596559; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=lVtAOszruAlXRUhdmLlMl09oS5i95scxy0aPVR8uQtM=; b=gAUWfWpgDOORglwPXvSNwb2YSMaSGNWaDikxqNfBVqmeNNHjNjQPaShkr4rCIzaK1BbvOA nZNfRM3cw0Z8mzHA/YZVI0xQC06jdBtIn+TlNjmUMYS9nSUJG+kyYCiztRaX55v2rtezs/ LUjnRtXqhghAZJ6iRxgPaey0Sepq+1mfTiFLhPtKSicMZZdci9knU11vgONff+kVkuurqv paS6cSrUqkzSLS/Z50dOoNH1ucXePlMnO2TWVfB2WbSwnGGiwzZGubPd82/o96zvV6Ua/K txrS6BLUgGX+Uqb624e4q1H7JGX4T4w9CyaecUpzWq1O3ae1qG2wGTHaAhopqQ== From: Luca Ceresoli Date: Tue, 19 Aug 2025 11:42:11 +0200 Subject: [PATCH v7 2/3] drm/bridge: add list of removed refcounted bridges Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250819-drm-bridge-debugfs-removed-v7-2-970702579978@bootlin.com> References: <20250819-drm-bridge-debugfs-removed-v7-0-970702579978@bootlin.com> In-Reply-To: <20250819-drm-bridge-debugfs-removed-v7-0-970702579978@bootlin.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 Between drm_bridge_add() and drm_bridge_remove() bridges are "published" to the DRM core via the global bridge_list and visible in /sys/kernel/debug/dri/bridges. However between drm_bridge_remove() and the last drm_bridge_put() memory is still allocated even though the bridge is not "published", i.e. not in bridges_list, and also not visible in debugfs. This prevents debugging refcounted bridges lifetime, especially leaks due to any missing drm_bridge_put(). In order to allow debugfs to also show the removed bridges, move such bridges into a new ad-hoc list until they are eventually freed. Note this requires adding INIT_LIST_HEAD(&bridge->list) in the bridge initialization code. The lack of such init was not exposing any bug so far, but it would with the new code, for example when a bridge is allocated and then freed without calling drm_bridge_add(), which is common on probe errors. Document the new behaviour of drm_bridge_remove() and update the drm_bridge_add() documentation to stay consistent. drm_bridge_add() needs special care for bridges being added after having been previously added and then removed. This happens for example for many non-DCS DSI host bridge drivers like samsung-dsim which drm_bridge_add/remove() themselves every time the DSI device does a DSI attaches/detach. When the DSI device is hot-pluggable this happens multiple times in the lifetime of the DSI host bridge. When this happens, the bridge->list is found in the removed list, not at the initialized state as drm_bridge_add() currently expects. Signed-off-by: Luca Ceresoli --- Changes in v7: - rebase on current drm-misc-next - remove if (drm_bridge_is_refcounted(bridge)), refcounting is now mandatory - add check to detect when re-adding a bridge that is in the removed list - improve commit message - fix typo This patch was added in v6. --- drivers/gpu/drm/drm_bridge.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 36e0829d25c29457cff5da5fec99646c74b6ad5a..2e688ee14b9efbc810bcdb0ab7e= cd4b688be8299 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -197,15 +197,22 @@ * driver. */ =20 +/* Protect bridge_list and bridge_removed_list */ static DEFINE_MUTEX(bridge_lock); static LIST_HEAD(bridge_list); +static LIST_HEAD(bridge_removed_list); =20 static void __drm_bridge_free(struct kref *kref) { struct drm_bridge *bridge =3D container_of(kref, struct drm_bridge, refco= unt); =20 + mutex_lock(&bridge_lock); + list_del(&bridge->list); + mutex_unlock(&bridge_lock); + if (bridge->funcs->destroy) bridge->funcs->destroy(bridge); + kfree(bridge->container); } =20 @@ -275,6 +282,7 @@ void *__devm_drm_bridge_alloc(struct device *dev, size_= t size, size_t offset, return ERR_PTR(-ENOMEM); =20 bridge =3D container + offset; + INIT_LIST_HEAD(&bridge->list); bridge->container =3D container; bridge->funcs =3D funcs; kref_init(&bridge->refcount); @@ -288,10 +296,13 @@ void *__devm_drm_bridge_alloc(struct device *dev, siz= e_t size, size_t offset, EXPORT_SYMBOL(__devm_drm_bridge_alloc); =20 /** - * drm_bridge_add - add the given bridge to the global bridge list + * drm_bridge_add - publish a bridge * * @bridge: bridge control structure * + * Add the given bridge to the global list of "published" bridges, where + * they can be found by users via of_drm_find_bridge(). + * * The bridge to be added must have been allocated by * devm_drm_bridge_alloc(). */ @@ -304,6 +315,14 @@ void drm_bridge_add(struct drm_bridge *bridge) =20 drm_bridge_get(bridge); =20 + /* + * If the bridge was previously added and then removed, it is now + * in bridge_removed_list. Remove it or bridge_removed_list will be + * corrupted when adding this bridge to bridge_list below. + */ + if (!list_empty(&bridge->list)) + list_del_init(&bridge->list); + mutex_init(&bridge->hpd_mutex); =20 if (bridge->ops & DRM_BRIDGE_OP_HDMI) @@ -344,9 +363,14 @@ int devm_drm_bridge_add(struct device *dev, struct drm= _bridge *bridge) EXPORT_SYMBOL(devm_drm_bridge_add); =20 /** - * drm_bridge_remove - remove the given bridge from the global bridge list + * drm_bridge_remove - unpublish a bridge * * @bridge: bridge control structure + * + * Remove the given bridge from the global list of "published" bridges, + * so it won't be found by users via of_drm_find_bridge(), and add it to + * the removed bridge list, to keep track of removed bridges until their + * allocated memory is actually freed. */ void drm_bridge_remove(struct drm_bridge *bridge) { @@ -357,7 +381,7 @@ void drm_bridge_remove(struct drm_bridge *bridge) br->funcs->bridge_event_notify(br, DRM_EVENT_BRIDGE_REMOVING, bridge); =20 mutex_lock(&bridge_lock); - list_del_init(&bridge->list); + list_move_tail(&bridge->list, &bridge_removed_list); mutex_unlock(&bridge_lock); =20 mutex_destroy(&bridge->hpd_mutex); --=20 2.50.1 From nobody Sat Oct 4 06:29:31 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 55C7A31AF12 for ; Tue, 19 Aug 2025 09:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755596572; cv=none; b=KIWLyVejKr2TG03UVddFdep0c3qVBQeyIs7S+/Pg/CDsNLt08xAUqTXoB746QTI17jWXowBGK1zzvBKVUCP+SrOxZt9dNUBQ3eRHQw4Ftb2S3bvKAyEjAtCYL97NYq3gFBL+PgtCTTvSYbn+bRntjtOX4RY8MFc+h/Yo8cALG6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755596572; c=relaxed/simple; bh=tbEbxC3lasitTEiFGF1v1C5EhcUL1XXAfMyzF3iDbUM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m+xGRdh+0VosT5d12y72eYgHYMTSEnmzEXnpwkuUGOWE52xU55TukbXBnI32iUatiGXOVZAPKWjIqAaR0fJXwhwXlV7dKZZ1HhCUQzMyRIiHTQ7NQV+yuBrdQFdTMAGbCWDx7eJ5LN/FkoFN7CjGUD03f9MMy0eEuA9j0OpHeQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=xXN6mLqv; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="xXN6mLqv" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 4BB741A09EE; Tue, 19 Aug 2025 09:42:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 247BD60697; Tue, 19 Aug 2025 09:42:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 22EA81C22A3C7; Tue, 19 Aug 2025 11:42:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1755596562; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=2zNEQPZm8ICen3OOvc7q25hoGo9P+jznlNsABvPRulI=; b=xXN6mLqvOUaVJoNCPpIvghQ8ufVJlS7dDO2xiPJ5CNBjIcvpn3Dsoje/ErdeiW/bcgPvXg e+bm7Ds9lm9vf4LNnRdjye7n2nbiuRf1RbalKE0Cxk2GsDMYBwortejAfo5/pD+SsXO+75 BiiCijda81WjuMOK9eT/TmopY1iW1EOBSMF8MWwMlgCVQUPcku4B2qUqcRKK930oGlz6wi +VD3F01DN+MfutUSzXRAfPRcsrTjAD7GDCPSG0z7Vmn/DRE2mmmoTcMZWMtdTzycjxGGQh 4oPDzg6q7mG5LhEsQ9h0XfNlRPoVvO9NZYTjkq1vf1tqkqkruXMEFzq6TFNTeQ== From: Luca Ceresoli Date: Tue, 19 Aug 2025 11:42:12 +0200 Subject: [PATCH v7 3/3] drm/debugfs: show removed bridges Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250819-drm-bridge-debugfs-removed-v7-3-970702579978@bootlin.com> References: <20250819-drm-bridge-debugfs-removed-v7-0-970702579978@bootlin.com> In-Reply-To: <20250819-drm-bridge-debugfs-removed-v7-0-970702579978@bootlin.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 The usefulness of /sys/kernel/debug/dri/bridges is limited as it only shows bridges between drm_bridge_add() and drm_bridge_remove(). However refcounted bridges can stay allocated for a long time after drm_bridge_remove(), and a memory leak due to a missing drm_bridge_put() would not be visible in this debugfs file. Add removed bridges to the /sys/kernel/debug/dri/bridges output. Signed-off-by: Luca Ceresoli --- Changes in v7: - rebased on current code which is in drm_bridge.c now - removed if (drm_bridge_is_refcounted(bridge)), refcounting is not optional - don't show bridge address - improve commit message This patch was added in v6. --- drivers/gpu/drm/drm_bridge.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 2e688ee14b9efbc810bcdb0ab7ecd4b688be8299..4e9ad8a198e357c448b82a1ff5e= 07e558a6168d6 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1498,17 +1498,20 @@ EXPORT_SYMBOL(devm_drm_put_bridge); =20 static void drm_bridge_debugfs_show_bridge(struct drm_printer *p, struct drm_bridge *bridge, - unsigned int idx) + unsigned int idx, + bool removed) { drm_printf(p, "bridge[%u]: %ps\n", idx, bridge->funcs); =20 - drm_printf(p, "\trefcount: %u\n", kref_read(&bridge->refcount)); + drm_printf(p, "\trefcount: %u%s\n", kref_read(&bridge->refcount), + removed ? " [removed]" : ""); =20 drm_printf(p, "\ttype: [%d] %s\n", bridge->type, drm_get_connector_type_name(bridge->type)); =20 - if (bridge->of_node) + /* The OF node could be freed after drm_bridge_remove() */ + if (bridge->of_node && !removed) drm_printf(p, "\tOF: %pOFfc\n", bridge->of_node); =20 drm_printf(p, "\tops: [0x%x]", bridge->ops); @@ -1534,7 +1537,10 @@ static int allbridges_show(struct seq_file *m, void = *data) mutex_lock(&bridge_lock); =20 list_for_each_entry(bridge, &bridge_list, list) - drm_bridge_debugfs_show_bridge(&p, bridge, idx++); + drm_bridge_debugfs_show_bridge(&p, bridge, idx++, false); + + list_for_each_entry(bridge, &bridge_removed_list, list) + drm_bridge_debugfs_show_bridge(&p, bridge, idx++, true); =20 mutex_unlock(&bridge_lock); =20 @@ -1549,7 +1555,7 @@ static int encoder_bridges_show(struct seq_file *m, v= oid *data) unsigned int idx =3D 0; =20 drm_for_each_bridge_in_chain_scoped(encoder, bridge) - drm_bridge_debugfs_show_bridge(&p, bridge, idx++); + drm_bridge_debugfs_show_bridge(&p, bridge, idx++, false); =20 return 0; } --=20 2.50.1