From nobody Mon Feb 9 09:01:20 2026 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 3149D392C41; Fri, 16 Jan 2026 17:33:17 +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=1768584800; cv=none; b=tMHDNnQEWkuFU2oWOKd7cmcaXT9CsuIQzGSa9qSraMgTaa5FHwTVdYNK3j6/cLZ1zRuOlEMXZF8qoEU9muG3Pbnfl4MTE26Y5eYnXSwN1nxRJaByAhE6D3WrkDtboKPMsdPh62dpjdXCBwF6H20Fzmx8B3T8PVi7a7KkkS+yqa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768584800; c=relaxed/simple; bh=iErtiSC36F3AUFBxqKldHjpcGezk5nxgqgJonzj+4wU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Mj9RRY5vTLidsRpeCMSLM4ZAdZ31tDAjk6oxBnXGvjLt7ZgkIM/U1xgoYDgbARuoN85kgJqwBwTqSmry1Pob8sqbiuYWwxXbHdQpx9o83lnBcJ0bjqv7rPDIjW6DqvXU9RHn2bozfjQY+kqptk5V18ccN+xWV0HvbqocyVksdsk= 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=J2VuVEmR; 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="J2VuVEmR" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7B7744E42118; Fri, 16 Jan 2026 17:33:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5122F606F9; Fri, 16 Jan 2026 17:33:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E44C810B68691; Fri, 16 Jan 2026 18:33:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768584795; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7D5QQyExNyfyjBaZdxllAyYcdraSblv1miW7+FtWhKM=; b=J2VuVEmRYXdllUmJsgqx8GMHcQE/5/YprW6IyoYLsat6DpJZlqslAM9KqXn1iXtvNmM0wL fG1JHM3/Bzqix74bdstRYq+XE4O1KFom7jH/RWcGRQeNDh87+4aJCPH9Vw3Bds2GG/Sftd fIMmL7l+udv1aCdoicKh8evbRyKnweqCbzn4vXVVvZrIt4/W+Iyz+mBElbcPGI+h94u50x DXKsiVZ6vgNP2MVtoyhlr2AUoR0ZhO56UyvSGlYdLPKcJOtoJKsJ8zZXq38Hhr2+fJ5N9Y ucEP4suRLY0MAkQ6Q9meC4rOlZcGJS2J4YHv1PA5rhOazDDs3xEKgCtnBD1FKA== From: Luca Ceresoli Date: Fri, 16 Jan 2026 18:32:36 +0100 Subject: [PATCH 1/6] drm: renesas: rz-du: rzg2l_du_encoder: convert to of_drm_find_and_get_bridge() 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: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-1-e34b38f50d27@bootlin.com> References: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> In-Reply-To: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Edmund Dea , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 of_drm_find_bridge() is deprecated. Move to its replacement of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it is put when done. This is made somewhat simpler by the fact that 'bridge' is a local variable. However we need to handle both branches of the main if(). In the 'else' case, just switch to of_drm_find_and_get_bridge() to ensure the bridge is not freed while in use in the function tail (drm_bridge_attach() mainly). In the 'then' case, devm_drm_panel_bridge_add_typed() already increments the refcount using devres which ties the bridge allocation lifetime to the device lifetime, so we would not need to do anything. However to have the same behaviour in both branches take an additional reference here, so that the bridge needs to be put whichever branch is taken without more complicated logic. Ensure to clear the bridge pointer however, to avoid calling drm_bridge_put() on an ERR_PTR. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c b/drivers/gpu= /drm/renesas/rz-du/rzg2l_du_encoder.c index 5e6dd16705e6..9b65bcefdb86 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c @@ -67,7 +67,7 @@ int rzg2l_du_encoder_init(struct rzg2l_du_device *rcdu, { struct rzg2l_du_encoder *renc; struct drm_connector *connector; - struct drm_bridge *bridge; + struct drm_bridge *bridge __free(drm_bridge_put) =3D NULL; int ret; =20 /* @@ -83,10 +83,16 @@ int rzg2l_du_encoder_init(struct rzg2l_du_device *rcdu, =20 bridge =3D devm_drm_panel_bridge_add_typed(rcdu->dev, panel, DRM_MODE_CONNECTOR_DPI); - if (IS_ERR(bridge)) - return PTR_ERR(bridge); + if (IS_ERR(bridge)) { + // Inhibit the cleanup action on an ERR_PTR + ret =3D PTR_ERR(bridge); + bridge =3D NULL; + return ret; + } + + drm_bridge_get(bridge); } else { - bridge =3D of_drm_find_bridge(enc_node); + bridge =3D of_drm_find_and_get_bridge(enc_node); if (!bridge) return -EPROBE_DEFER; } --=20 2.52.0 From nobody Mon Feb 9 09:01:20 2026 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 2D6EB39526A for ; Fri, 16 Jan 2026 17:33:20 +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=1768584803; cv=none; b=MrdNif07wXIaQ3n4fRaPynhU8yC9O47StimN6NQOP4yUPpyQiWr50wJ3em7DQ2b04tLbo9lKTZY8+QZnF4R1Ivc+K3H9KMj55ZYWsCuWinTGunI0sQZ0BLlcnVA0exOforQswvEkG5nflxCzRmHnpMi4sJWNQ5CHHMc42M8MDdk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768584803; c=relaxed/simple; bh=BHMI5cZX0CNLkjeQo46La9pw6SwOIPMWy1ez9c7bmQM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hca2xq5+y3ecETs18fCXUW8KDdp00hLrs+sMw1GyMrYd/Gyf4F8RK1Ewhu6aIUzmlPSy7CVaaQMQYQ9W+9ZC4kbtIDP5MpOJrXoF6+gBJqupLwoJs3EgoypIfOychekxZ8RpyUAu3CQ8Lfdqj8wOwFz1h18FDVaMkNEQ6znDVFQ= 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=00DqBXZ6; 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="00DqBXZ6" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 516501A28AA; Fri, 16 Jan 2026 17:33:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 255C5606F9; Fri, 16 Jan 2026 17:33:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 805F510B686BE; Fri, 16 Jan 2026 18:33:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768584797; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=XWvPrNM51DRgWiT+4jttnUuVuHPq0djc3tV/ZM+m9o0=; b=00DqBXZ6UzRS/aLVK8QYcupDhaJq22/amgLzGzGLat9m1McDxVvnZWaWYcempf+fR2a7HU 1R6db19pMLi01HSus6kmbRMWs/XSQw/2qo/zarYhZA8kvD4EpezBG7BqINkxFFuFcwPPXy DeEjCoebOCKMgVHlvy0yDC6g/7xQvtlgWRG4reDyXaMNy75RXZDajrLlr2XRWEswvdEz7B SigPnEoirPQSC/Q9geO34Zjs9IucigYxXvu8XDoh98A6jN+M5TdwtpeROD0zvcOXl2rEYX QgfolNwhVT1pd/X+VHTjgGr0ADW4FhlpydZ4OBkMjTW+Kw4FNp+Hlz9ZFhP3Gw== From: Luca Ceresoli Date: Fri, 16 Jan 2026 18:32:37 +0100 Subject: [PATCH 2/6] drm/kmb/dsi: convert to of_drm_find_and_get_bridge() 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: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-2-e34b38f50d27@bootlin.com> References: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> In-Reply-To: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Edmund Dea , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 of_drm_find_bridge() is deprecated. Move to its replacement of_drm_find_and_get_bridge() which gets a bridge reference. This driver has global variables for the DSI host and DSI device, and code to allocate them on probe but no code to free them when on remove. So it does not at all support removal, and not even multiple instances. For this reason putting the reference would be pointless here. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/kmb/kmb_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c index faf38ca9e44c..8c8908c3bf32 100644 --- a/drivers/gpu/drm/kmb/kmb_dsi.c +++ b/drivers/gpu/drm/kmb/kmb_dsi.c @@ -251,7 +251,7 @@ int kmb_dsi_host_bridge_init(struct device *dev) return -EINVAL; } /* Locate drm bridge from the hdmi encoder DT node */ - adv_bridge =3D of_drm_find_bridge(encoder_node); + adv_bridge =3D of_drm_find_and_get_bridge(encoder_node); of_node_put(dsi_out); of_node_put(encoder_node); if (!adv_bridge) { --=20 2.52.0 From nobody Mon Feb 9 09:01:20 2026 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 A83A23939BE for ; Fri, 16 Jan 2026 17:33:23 +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=1768584807; cv=none; b=iK5LCybvOX+GkBQCmRhskIsEOyNEeTDQQV8XJrJyQxLVyz6NZfMGS2vqWoYzGi1uBkMYZO1gYMAjVeF0lPBq38p6/4gPLOdwwzYCEoO8/qtvbWMJCWXMuabtMROYdVa52nuKH71vy8GXpSqwd+Xm4pw6qyK+lMGE/0TT7o4bxFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768584807; c=relaxed/simple; bh=22ZUyODgCQrkw0xGdlQfjJFi8n3l1aokaQjxeqDFD5k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sXbcKazCOzl1rYQXHSYKrM2f36kn1+QAyf7BVGwjdaLuttQE9rMLE3D8NReHtWERRSnZCvSfIkGcEGsoBcaP+MywXnc9RsM2LYywEC+Sf8pHCpaqODe24AAhDve4ozw+97aDrykNfdQAFI59S9jVQ6fCU0zpdI+j9+ChwP9H8nU= 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=A9nNee/q; 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="A9nNee/q" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 39F281A28A2; Fri, 16 Jan 2026 17:33:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0EF58606F9; Fri, 16 Jan 2026 17:33:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 32EFE10B686C1; Fri, 16 Jan 2026 18:33:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768584800; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=JT9tt5+vYn3tFfsnu8u8PU5Tm0hiFHW/bTFd3Um4N54=; b=A9nNee/qOpnUVD2WtdF3s+ntVaBnalIdxUrWhBAOVWYK8A9JkH8SGy9jJyEZISOfp/xNBi aJAgRnBAeiSypskHt48RCbtHRZ3LuYnwhXw2H0DlzgLIlXy1Vo5tiKNBrn9i1nTn6P5DK+ X6qPQpTn0cGxo1COQrpOoBPrmektQEQVyKjCYu2ruemb56iS9CNBIaPsfApeBkFR1e9lfx 3lbdZTh+aD+BE62caxX363CQD7SlnZ682uZP4EW7m/TLzDjXtmRGCcDh+6PlGYkC1x3Kd/ 3g97XosijAtgCfvN4PN0ZOmcOtNP6BcMiWuvr1P6dJQ9S/zeMgSPav0h6zvmLQ== From: Luca Ceresoli Date: Fri, 16 Jan 2026 18:32:38 +0100 Subject: [PATCH 3/6] drm/mcde: dsi: warn in case of multiple subnodes 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: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-3-e34b38f50d27@bootlin.com> References: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> In-Reply-To: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Edmund Dea , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 mcde_dsi_bind() has a loop over all subnodes looking for a panel, but does not exit when a match is found and only stores the last match. However this will be problematic when introducing refcounting on the struct drm_device pointer in a following commit, because of_drm_find_and_get_bridge() would get a reference to multiple bridges. Assuming there is no real reason for looking for multiple panels, add a warning so it gets noticed in case the assumption is wrong. Signed-off-by: Luca Ceresoli --- I think the correct thing to do would be adding a break statement when there is a match. However I don't have knowledge of this driver and the hardware, thus this patch is a prudential alternative, not changing the behaviour. --- drivers/gpu/drm/mcde/mcde_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index a3423459dd7a..3faebe571fc2 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -1103,6 +1103,9 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, =20 /* Look for a panel as a child to this node */ for_each_available_child_of_node(dev->of_node, child) { + /* There should be only one panel subnode */ + WARN_ON(panel || bridge); + panel =3D of_drm_find_panel(child); if (IS_ERR(panel)) { dev_err(dev, "failed to find panel try bridge (%ld)\n", --=20 2.52.0 From nobody Mon Feb 9 09:01:20 2026 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 C903536BCC4; Fri, 16 Jan 2026 17:33:26 +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=1768584812; cv=none; b=O5eG8BZEIn8LIDj3KanzHEmZuLPabH10wacj1fyaV0ZkigO0zIQtick7SDEIb4pJ4Ad73/wm8EqZ8OAsinX8Ho+ijMwlq6ixppE1Jt7seQq7fxdMGLYRnxtfSpBaaQ7M66jYIzvXYmcrEXQ72YJi6Yqaamt8pYX1dmRIotj6/AQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768584812; c=relaxed/simple; bh=q9mLaWcGE4un8yS+lqE3JMtbmXu+0+3wNFfi1FGdm4Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZwYY7d+Cu4iei7z7c8cDdt85Nk2qkMiWv3mg4ugBgyI0j/qe3/Pctogh9Nz8RM5omiSycP0mGcP4nj9RbGqFhi5bcyNuGin5ZlmdNk7jLRB85ViK46KnIwm5NcFSwpI6RwTVi1SZnOmcRv7YmLcMqlD6sVrqIgujJJ9oOamkibM= 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=nHWU4I0+; 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="nHWU4I0+" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 79643C1F1FD; Fri, 16 Jan 2026 17:32:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4C875606F9; Fri, 16 Jan 2026 17:33:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0B9F610B688EC; Fri, 16 Jan 2026 18:33:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768584803; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=GMcadQbEAhLIcK+wFfr5iTPjY0nkzGM3bzuOMc2uZCs=; b=nHWU4I0+KxmgIAhJj+X+1QvYlCO+E9NOovnKwgGx+IUuRkMoMOfeP+9FEeg3wGxe0S6B1h pNhC3bvl/d1es3WQnFfQeXJX4d19PIkVVoU0IOtehR1/YN7/4T2oaJP6p8YzcTLS/t9hh1 ZjX+zAUFAucjU8RvPToqcBv0EvKRNeOPyiFA63JGeLUEUXWBDk/wP+P9JGyKPM0yOV2Erv 6XNyv3eX1Fzr8GsEtMBRn51+mm51hRnsF3etAj6SFvEvLn53VjHLdJ46iBGUNe5M+Onxru kp25OLSHFDYuDQ+3xgj5htmztvHgvh7zv3VWkOngMUqbGAergZMi3+3oXJfrXA== From: Luca Ceresoli Date: Fri, 16 Jan 2026 18:32:39 +0100 Subject: [PATCH 4/6] drm/mcde: dsi: convert to of_drm_find_and_get_bridge() 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: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-4-e34b38f50d27@bootlin.com> References: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> In-Reply-To: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Edmund Dea , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 of_drm_find_bridge() is deprecated. Move to its replacement of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it is put when done. We need to handle the two cases: when a panel is found and when it isn't, even though the latter is not supported. So: * in case a panel is not found and bridge is, get a reference to the found bridge * in case a panel is found, get a reference to the panel_bridge when it is added, so the following code always get exactly one reference that it needs to put Finally, use the next_bridge pointer in struct drm_bridge in order to simplify putting the reference. Signed-off-by: Luca Ceresoli Acked-by: Linus Walleij --- drivers/gpu/drm/mcde/mcde_dsi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index 3faebe571fc2..bd2135fd4293 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -40,7 +40,6 @@ struct mcde_dsi { struct mcde *mcde; struct drm_bridge bridge; struct drm_panel *panel; - struct drm_bridge *bridge_out; struct mipi_dsi_host dsi_host; struct mipi_dsi_device *mdsi; const struct drm_display_mode *mode; @@ -1060,7 +1059,7 @@ static int mcde_dsi_bridge_attach(struct drm_bridge *= bridge, } =20 /* Attach the DSI bridge to the output (panel etc) bridge */ - return drm_bridge_attach(encoder, d->bridge_out, bridge, flags); + return drm_bridge_attach(encoder, d->bridge.next_bridge, bridge, flags); } =20 static const struct drm_bridge_funcs mcde_dsi_bridge_funcs =3D { @@ -1076,7 +1075,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, struct mcde_dsi *d =3D dev_get_drvdata(dev); struct device_node *child; struct drm_panel *panel =3D NULL; - struct drm_bridge *bridge =3D NULL; + struct drm_bridge *bridge __free(drm_bridge_put) =3D NULL; =20 if (!of_get_available_child_count(dev->of_node)) { dev_info(dev, "unused DSI interface\n"); @@ -1112,7 +1111,8 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, PTR_ERR(panel)); panel =3D NULL; =20 - bridge =3D of_drm_find_bridge(child); + drm_bridge_put(bridge); // In case of multiple matching loops + bridge =3D of_drm_find_and_get_bridge(child); if (!bridge) { dev_err(dev, "failed to find bridge\n"); of_node_put(child); @@ -1127,6 +1127,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, dev_err(dev, "error adding panel bridge\n"); return PTR_ERR(bridge); } + drm_bridge_get(bridge); dev_info(dev, "connected to panel\n"); d->panel =3D panel; } else if (bridge) { @@ -1138,7 +1139,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, return -ENODEV; } =20 - d->bridge_out =3D bridge; + d->bridge.next_bridge =3D drm_bridge_get(bridge); =20 /* Create a bridge for this DSI channel */ d->bridge.of_node =3D dev->of_node; @@ -1158,7 +1159,7 @@ static void mcde_dsi_unbind(struct device *dev, struc= t device *master, struct mcde_dsi *d =3D dev_get_drvdata(dev); =20 if (d->panel) - drm_panel_bridge_remove(d->bridge_out); + drm_panel_bridge_remove(d->bridge.next_bridge); regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET, PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0); } --=20 2.52.0 From nobody Mon Feb 9 09:01:20 2026 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 2818D339857 for ; Fri, 16 Jan 2026 17:33:30 +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=1768584813; cv=none; b=hJ3h2WqaEy9g5MrKAHTIJ3MT8COjrxSym2VpxXeGPif3rzCBot05wjExb1A0SJXTRPb+hltZxMtwW5hwap6Waz3hNSwRH+kgQ86qUMViXWFcpEwXTbnWsu98z+tTiazg16NhMN80/Gn+kRkMfLlqr4zpgvBvwa1CwpOFL8qSiq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768584813; c=relaxed/simple; bh=ShRFWf1YL24jawc7E6qTAvPINLwJqZZgNut/y12/vXY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uEaJADg6p2hwVID3CrzeSXbsTqtsRARUpT1wwCrA1ZNAxw7wiY3GMplzo4zELlUpUpQuM3yNe+NtS5yWce8whzcnoESTT9BMypDjg5kaHFJTEcoVVzpGbEKSTAlzvjIC/la8IGYX+6qa9FcUZnHP2fhzMJWr30Uoyg7YTst8ZIk= 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=KAPTPmnn; 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="KAPTPmnn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C10114E42118; Fri, 16 Jan 2026 17:33:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 95A02606F9; Fri, 16 Jan 2026 17:33:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1134310B688E1; Fri, 16 Jan 2026 18:33:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768584806; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=IPtDTV3UxlBAHCLMExW04W6Gb1rrw7CzH5qBCtmWqiA=; b=KAPTPmnnjRUqFzYQwlXrdMQ+txz0ssC2vFdma/o8WJHrCIABQVM0Ofy0BoP6lHmRFgl21Z V3djt9VSZXNAhv1Bo9Bacf9ceoZSc6GRONleOsY11fUK6Fo+CAvYndv+A2hNgov0waPRi/ hggNJU1ptHojmhF2njIOEGx7pG/DlnZOQuL4CaQRK2oHvC+zDyCAcvkkgEFdchA1mbATKD MILG36rIOmXr8raaVFwuCXv/qcdtJymaJh1kUWo2ASv6ri3w20prmnu5jc8Dh+uLZSItNP t444gsnAK03aqV7+Pu0UNEX1ZRuYGcAefe1ZVZUcGBmUMEx0NOXLstvX5r9fOg== From: Luca Ceresoli Date: Fri, 16 Jan 2026 18:32:40 +0100 Subject: [PATCH 5/6] drm: rcar-du: encoder: convert to of_drm_find_and_get_bridge() 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: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-5-e34b38f50d27@bootlin.com> References: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> In-Reply-To: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Edmund Dea , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 of_drm_find_bridge() is deprecated. Move to its replacement of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it is put when done. We need to handle the two cases: when a panel_bridge is added and when it isn't. So: * in the 'else' case a panel_bridge is not added and bridge is found: use of_drm_find_and_get_bridge() to get a reference to the found bridge * in the 'then' case a panel_bridge is found using a devm function which already takes a refcount and will put it on removal, but we need to take another so the following code in this function always get exactly one reference that it needs to put In order to put the reference, add the needed drm_bridge_put() calls in the existing cleanup function. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 28 ++++++++++++++++++-= ---- drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.h | 1 + drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 2 ++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c b/drivers/gp= u/drm/renesas/rcar-du/rcar_du_encoder.c index 7ecec7b04a8d..5789fc75092f 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c @@ -51,7 +51,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, { struct rcar_du_encoder *renc; struct drm_connector *connector; - struct drm_bridge *bridge; + struct drm_bridge *bridge __free(drm_bridge_put) =3D NULL; int ret; =20 /* @@ -69,20 +69,26 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, =20 bridge =3D devm_drm_panel_bridge_add_typed(rcdu->dev, panel, DRM_MODE_CONNECTOR_DPI); - if (IS_ERR(bridge)) - return PTR_ERR(bridge); + if (IS_ERR(bridge)) { + // Inhibit the cleanup action on an ERR_PTR + ret =3D PTR_ERR(bridge); + bridge =3D NULL; + return ret; + } + + drm_bridge_get(bridge); } else { - bridge =3D of_drm_find_bridge(enc_node); + bridge =3D of_drm_find_and_get_bridge(enc_node); if (!bridge) return -EPROBE_DEFER; =20 if (output =3D=3D RCAR_DU_OUTPUT_LVDS0 || output =3D=3D RCAR_DU_OUTPUT_LVDS1) - rcdu->lvds[output - RCAR_DU_OUTPUT_LVDS0] =3D bridge; + rcdu->lvds[output - RCAR_DU_OUTPUT_LVDS0] =3D drm_bridge_get(bridge); =20 if (output =3D=3D RCAR_DU_OUTPUT_DSI0 || output =3D=3D RCAR_DU_OUTPUT_DSI1) - rcdu->dsi[output - RCAR_DU_OUTPUT_DSI0] =3D bridge; + rcdu->dsi[output - RCAR_DU_OUTPUT_DSI0] =3D drm_bridge_get(bridge); } =20 /* @@ -135,3 +141,13 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, =20 return drm_connector_attach_encoder(connector, &renc->base); } + +void rcar_du_encoder_cleanup(struct rcar_du_device *rcdu) +{ + int i; + + for (i =3D 0; i < RCAR_DU_MAX_LVDS; i++) + drm_bridge_put(rcdu->lvds[i]); + for (i =3D 0; i < RCAR_DU_MAX_DSI; i++) + drm_bridge_put(rcdu->dsi[i]); +} diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.h b/drivers/gp= u/drm/renesas/rcar-du/rcar_du_encoder.h index e5ec8fbb3979..b2b5e93f30f8 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.h +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.h @@ -25,5 +25,6 @@ struct rcar_du_encoder { int rcar_du_encoder_init(struct rcar_du_device *rcdu, enum rcar_du_output output, struct device_node *enc_node); +void rcar_du_encoder_cleanup(struct rcar_du_device *rcdu); =20 #endif /* __RCAR_DU_ENCODER_H__ */ diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/dr= m/renesas/rcar-du/rcar_du_kms.c index 6294443f6068..15d301ab5eef 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c @@ -836,6 +836,8 @@ static void rcar_du_modeset_cleanup(struct drm_device *= dev, void *res) =20 for (i =3D 0; i < ARRAY_SIZE(rcdu->cmms); ++i) platform_device_put(rcdu->cmms[i]); + + rcar_du_encoder_cleanup(rcdu); } =20 int rcar_du_modeset_init(struct rcar_du_device *rcdu) --=20 2.52.0 From nobody Mon Feb 9 09:01:20 2026 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 46E0E396B62; Fri, 16 Jan 2026 17:33: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=1768584821; cv=none; b=qci1+xhacnGqajbxD6L2SlO8xTrz4fQHKHKrDhb448lqaWGsxdomEukaDygMcE4oxxgqDTl3hw7T/QNpAUHi/VMIAy1n6+nV/6xyadYX4H6/pSdcQg++YGSuVGi2do26f1pnF6lmcE+en7hgVkcz/3YhBsIrghlWd+BX7gAJkd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768584821; c=relaxed/simple; bh=da+9ANNyk2TMvXnOxiVzC4dW2zw1HjxV8qtIsktsSF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H+9VKGNVvgEqMufnw8cLyfWExJyV1j9U8lZdVAvCPwSOUBmdTmEySp/WLqM9zrglkufwiHC6qlUBB/eCxAUeAinNaAu2KshzCro5bZ/KWaN0e9/db2YZDB9HVS7t8oFLcrn8JdRXO8qgVw6Qr5KmwP4TiWXavybqP73kb47EmMg= 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=m+wPxr6s; 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="m+wPxr6s" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id A6CD8C1F1FE; Fri, 16 Jan 2026 17:33:03 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7A4EF606F9; Fri, 16 Jan 2026 17:33:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B9A1110B681F3; Fri, 16 Jan 2026 18:33:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768584809; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=CZGuLlcCDhUQzMpgbzcJjOknGYU49cHjJL/LspbQFv4=; b=m+wPxr6s1B1ZEDZXmHaVjHcdy1wES6LaXUzBc+SfMYn67bMCf5i6K5y/+1haIL3StlkdiH /M8WCvnArISU6u276Z4YEY6AbGn6RLuEBgtfP++NelIhyfzJ/bLbtdy9jYz5q23vayV4x7 49k1fa+mXo9dDLWRECGYQPwHzs1zqvXwk03HZqSeUqGnMha9+oFHAp+wzo65PiavsMRnX/ 1ekLX+c8o99JhdohxPopmxmj3Hcks0Z6oF2TS7MPx2q+cnnv7JqUJDkcB+6ELiuJhxTbJp UtI+us2zqB2odkpP4ZciaQzsJfvzumTuRWmpH9lzL8E3gfJvzWh1qGbWQs0Khg== From: Luca Ceresoli Date: Fri, 16 Jan 2026 18:32:41 +0100 Subject: [PATCH 6/6] drm/omap: dss: convert to of_drm_find_and_get_bridge() 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: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-6-e34b38f50d27@bootlin.com> References: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> In-Reply-To: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-0-e34b38f50d27@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , Edmund Dea , Linus Walleij , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Tomi Valkeinen Cc: Hui Pu , Ian Ray , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 of_drm_find_bridge() is deprecated. Move to its replacement of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it is put when done. omapdss_device_init_output() can take one bridge pointer in out->bridge or two pointers in out->bridge and out->next_bridge. Ensure each has a corresponding drm_bridge_get() and add drm_bridge_put() calls in the cleanup code. Also slightly change the initial code assigning out->panel and out->bridge to ensure and clarify that either out->panel or out->bridge is set in the function prologue, not both. If both were set, the 'if (out->panel){...}' code that follows would overwrite out->bridge without having put the reference. Finally, take a reference in case a panel_bridge is added using drm_panel_bridge_add(). This ensures we always need to put a reference, which came either from of_drm_find_and_get_bridge() or by the drm_panel_bridge_add+drm_bridge_get() branch. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/omapdrm/dss/output.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm= /dss/output.c index 7378e855c278..ca891aba3820 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c @@ -30,11 +30,13 @@ int omapdss_device_init_output(struct omap_dss_device *= out, return 0; } =20 - out->bridge =3D of_drm_find_bridge(remote_node); out->panel =3D of_drm_find_panel(remote_node); if (IS_ERR(out->panel)) out->panel =3D NULL; =20 + if (!out->panel) + out->bridge =3D of_drm_find_and_get_bridge(remote_node); + of_node_put(remote_node); =20 if (out->panel) { @@ -49,7 +51,7 @@ int omapdss_device_init_output(struct omap_dss_device *ou= t, goto error; } =20 - out->bridge =3D bridge; + out->bridge =3D drm_bridge_get(bridge); } =20 if (local_bridge) { @@ -59,7 +61,7 @@ int omapdss_device_init_output(struct omap_dss_device *ou= t, } =20 out->next_bridge =3D out->bridge; - out->bridge =3D local_bridge; + out->bridge =3D drm_bridge_get(local_bridge); } =20 if (!out->bridge) { @@ -79,6 +81,9 @@ void omapdss_device_cleanup_output(struct omap_dss_device= *out) if (out->bridge && out->panel) drm_panel_bridge_remove(out->next_bridge ? out->next_bridge : out->bridge); + + drm_bridge_put(out->next_bridge); + drm_bridge_put(out->bridge); } =20 void dss_mgr_set_timings(struct omap_dss_device *dssdev, --=20 2.52.0