From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 039E3C83F1A for ; Thu, 10 Jul 2025 08:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cZDNKWbGVaFbjs3YOxHtzOLyt6eGhWoUEJBg5GIpV3M=; b=d51MApgJOyhqHTtqlgjEm2CaRf ZNMF2pk2KHTkEhJSDf1OayvilsrxRAGGGAyoqYjxnVMI82yRNB+En0KOurRJM5DawMTeQ+/S4m9SU avFWwcXeGuEGEYWN8HfhjMG67pHK0374RquT8a8sG7C5WQ0Kmbo6bHbTxChED53KfYFlODGEPiIbV qpEXrlIBUOKUM7RLATZ2vbNhmV68m0rGohUZqKHPWoA9Xu7Cf/aBxNgs+qM5ATtpX6oqn3OH5PnZ0 4Q7hibAj0JbeoJfkAA1q/z6VtReaQfL+kFaatABDpOfNMWeIxVShfljpA+TQoSGU8agPuLzcJZk11 0lQS5x/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uZmV3-0000000B9H6-3H95; Thu, 10 Jul 2025 08:19:25 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uZlgW-0000000B0H2-2vP6 for linux-arm-kernel@lists.infradead.org; Thu, 10 Jul 2025 07:27:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id D30336146B; Thu, 10 Jul 2025 07:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A971C4CEE3; Thu, 10 Jul 2025 07:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752132431; bh=yR1yt72iESvtf706LR6VBiJOb+AEKItKxPYtLvUPyhE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tYCfigXhEmpMraXE+SzXg57pc60PfyVnaArkCqeGznlOXwQ/Y9NhpkO+Ca38NVEvl iQGVB9QNpqZ7usSvT5+8Mni8RdimYhCSzk++msnaC58io7HbuMjZ5FRIgW80PKpBG1 ee8QPhmOLACZGKx3Q3u8NBqvRQIHHi6J/Hi75YTp/9ocEBaHACMI17Md1M7DIpIJGz KRWDV+pjp1AG8XJrHBu9crlyo98Ay7Ksg0CcVwvb85nncbsYUzkN4vuUCMSiUSMMyZ YXghCMXRjORlRJbbZzsYmX1XvdoP8gUON9ZxsBNxnTAiUFbKyPG4BaxF5oicIIRVZb 2Vvp3osNZJsNw== Date: Thu, 10 Jul 2025 09:27:09 +0200 From: Maxime Ripard To: Luca Ceresoli Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Liu Ying , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Tomi Valkeinen , Philipp Zabel , Hui Pu , Thomas Petazzoni , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 8/9] drm/bridge: put the bridge returned by drm_bridge_get_next_bridge() Message-ID: <20250710-classic-bouncy-caiman-8e2045@houat> References: <20250709-drm-bridge-alloc-getput-drm_bridge_get_next_bridge-v1-0-48920b9cf369@bootlin.com> <20250709-drm-bridge-alloc-getput-drm_bridge_get_next_bridge-v1-8-48920b9cf369@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="3v6clpzuhyggvmrg" Content-Disposition: inline In-Reply-To: <20250709-drm-bridge-alloc-getput-drm_bridge_get_next_bridge-v1-8-48920b9cf369@bootlin.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --3v6clpzuhyggvmrg Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 8/9] drm/bridge: put the bridge returned by drm_bridge_get_next_bridge() MIME-Version: 1.0 Hi, On Wed, Jul 09, 2025 at 06:48:07PM +0200, Luca Ceresoli wrote: > The bridge returned by drm_bridge_get_next_bridge() is refcounted. Put it > when done. >=20 > Signed-off-by: Luca Ceresoli You should really expand a bit more your commit logs, and provide the context of why you think putting drm_bridge_put where you do is a good idea. > --- > drivers/gpu/drm/drm_bridge.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c > index 0b450b334afd82e0460f18fdd248f79d0a2b153d..05e85457099ab1e0a23ea7842= c9654c9a6881dfb 100644 > --- a/drivers/gpu/drm/drm_bridge.c > +++ b/drivers/gpu/drm/drm_bridge.c > @@ -1147,6 +1147,8 @@ drm_atomic_bridge_propagate_bus_flags(struct drm_br= idge *bridge, > } else { > next_bridge_state =3D drm_atomic_get_new_bridge_state(state, > next_bridge); > + drm_bridge_put(next_bridge); > + > /* > * No bridge state attached to the next bridge, just leave the > * flags to 0. In particular, I don't think it is here. You still have a variable in scope after that branch that you would have given up the reference for, which is pretty dangerous. Also, the bridge state lifetime is shorter than the bridge lifetime itself, so we probably want to have the drm_bridge_put after we're done with next_bridge_state too. Overall, I think using __free here is probably the most robust solution. Maxime --3v6clpzuhyggvmrg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCaG9rTAAKCRAnX84Zoj2+ dr15AYCUDUXM2027tbhyBFNnTMDtHivlc5bgpEwgheOP8GXxP7YFX/QLF0BkDV7V DnRK0VQBfAsNfigLg8ct5uD7iCc3b1OYcgl8hgrtM7STVo7OZSQpRSJyWJv9Amo6 YYUahgkEQw== =3R2K -----END PGP SIGNATURE----- --3v6clpzuhyggvmrg--