From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 D620437B3ED for ; Wed, 18 Mar 2026 08:26:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773822366; cv=none; b=ZNUPXOqXALktFPl7zZs5zz59hv723/H0LxIab8TxXV5kv96+72XSfaXwWJrCAsEGWpTmhlDH5fHiSezV1UBkfkL3nHOPjTZTUC0TopvjdhrgmgwWYB6H4hqNNHvlIkKrrc1EVne32t2LMZadMtPGmpyxBQFp+EGxSEjlqf+1yi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773822366; c=relaxed/simple; bh=YTazXHmXNByTAZhL0l89BRy40LSD5MZRwIO4a9EnF7U=; h=Mime-Version:Content-Type:Date:Message-Id:From:Subject:Cc:To: References:In-Reply-To; b=Ip+u8vrszKf7hMuNDL+fTH1S8qII9fWDnRzpVfwWoXmpTbZNG74gMGhzCxYQc9skCdscTxyg73TySmf+MtR5zYIpN0kPFTzx22Q8t2JSJNZQ+TwLBlh2xa2ee9jr/2SligjxdUX8Gc1nf/rHcP8pe1EuVtm2WBBf++UiRJNK3XI= 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=YtFM2TBm; arc=none smtp.client-ip=185.246.85.4 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="YtFM2TBm" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BB2854E426E5; Wed, 18 Mar 2026 08:26:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 855E560050; Wed, 18 Mar 2026 08:26:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 69200104506B6; Wed, 18 Mar 2026 09:25:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773822354; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=jklowRBIPrCpmZeab4ftNAYk2L8Ww36BQPRSWzmduYY=; b=YtFM2TBm2PeYawvnlspTLypBD26nCAy/B9Aqc97kiwaiRGktFVvylPIlk7WDmy3MEa+CtI tFlJMVpUTK0umXdwlv5qsMeWGRwfrQYT4NSorvQbtsCsfVGZa6vRtk6PSZFlHfQlsSc3FW LeQVygXVPI0byOEHL91genAAQWuaQnOvN05qGompN93+XPevrIkPkVRYiCowqZya+hfArZ HoSQTLqqGG02Ntnp0g33Wm5OEzb8RnOL7ecum8ZFK+9SJ+AVQ0gKn0wBm/JIZ9LSCVqzTU IYhAux+aLh/jnx1yJmyvDzCyRpBJJXOJm9/crVFEqwEqo8BBj6VIyi7CrQ3xig== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 18 Mar 2026 09:25:48 +0100 Message-Id: From: "Luca Ceresoli" Subject: Re: [PATCH v3] drm/bridge: Fix refcount shown via debugfs for encoder_bridges_show() Cc: "Marco Felsch" , , To: "Liu Ying" , "Andrzej Hajda" , "Neil Armstrong" , "Robert Foss" , "Laurent Pinchart" , "Jonas Karlman" , "Jernej Skrabec" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" X-Mailer: aerc 0.20.1 References: <20260318-drm-misc-next-2026-03-05-fix-encoder-bridges-refcount-v3-1-147fea581279@nxp.com> In-Reply-To: <20260318-drm-misc-next-2026-03-05-fix-encoder-bridges-refcount-v3-1-147fea581279@nxp.com> X-Last-TLS-Session-Version: TLSv1.3 On Wed Mar 18, 2026 at 6:26 AM CET, Liu Ying wrote: > A typical bridge refcount value is 3 after a bridge chain is formed: > - devm_drm_bridge_alloc() initializes the refcount value to be 1. > - drm_bridge_add() gets an additional reference hence 2. > - drm_bridge_attach() gets the third reference hence 3. > > This typical refcount value aligns with allbridges_show()'s behaviour. > However, since encoder_bridges_show() uses > drm_for_each_bridge_in_chain_scoped() to automatically get/put the > bridge reference while iterating, a bogus reference is accidentally > got when showing the wrong typical refcount value as 4 to users via > debugfs. Fix this by caching the refcount value returned from > kref_read() while iterating and explicitly decreasing the cached > refcount value by 1 before showing it to users. > > Fixes: bd57048e4576 ("drm/bridge: use drm_for_each_bridge_in_chain_scoped= ()") > Signed-off-by: Liu Ying Reviewed-by: Luca Ceresoli Tested-by: Luca Ceresoli Thanks! Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com