From nobody Mon Feb 9 04:03:14 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 AFEDE33986F for ; Sat, 31 Jan 2026 15:58:51 +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=1769875133; cv=none; b=WGmktvrnA8NU/eCZzX/7QDtfFxlgHMLvsBfWDSSdqvM3FTutAq0cSD8FRmnkBYauETCkrM2o1yo6MTlQfQpYbrhbE3llDAKpX0YMVJYtDEYOSnKI7kce4G8aVb/ijhfJtIV5yMWJqjfLobF4SXYfZtHYlAuo7AdcVi/JGYEnDjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875133; c=relaxed/simple; bh=iErtiSC36F3AUFBxqKldHjpcGezk5nxgqgJonzj+4wU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mO5CD+b56H8SOWOjzqHRTB+PB9L6VLjWpWzK8Q0EqEKCMCJLArcdKJsZ1OpUBXTbGM4EbD8gDtMoqQTqI17yFnly5iF16u81SjJutosU1mLf+gndit3X/7/tMiMQ3rzF/iZP/ePSJ+0qpnvI8FfZh31BLqqu3LTpmORdaT9ZHSg= 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=auoOheU+; 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="auoOheU+" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id CF80DC22F7F; Sat, 31 Jan 2026 15:58:53 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E0DEF606B6; Sat, 31 Jan 2026 15:58:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EFD1A119A88ED; Sat, 31 Jan 2026 16:58:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875128; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=7D5QQyExNyfyjBaZdxllAyYcdraSblv1miW7+FtWhKM=; b=auoOheU+CekEL7kZy2raJxgMy2+4BJCd9bzG4l8fMbaKcUt5CdrqETkEXoPeK/R8VkpZU4 zVencQcmCyH2YCP4ntH6FjCtTw8/WnpbceEW1PtF+EXHdsSxZ63d4SE0Hb2W+09rOgWw1m +99hTbNikHxU7s3i3/7ot8OmK/XuUZS9NselxzwNfA0q4RQOH+YAZWhoD0/TZbAr5NfxjT yITTq+VCuvvjfKxGcy/spdYizZHvofglLDoti4axaREWrHGEozjn6B6YOhi9Vq3N+xYPm5 bT0GFPscK/5YyPbv5feh/2zfE++t79EtLVJiDHtUvU+HM33KvVoyGfWgNsKcjw== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:33 +0100 Subject: [PATCH v2 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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-1-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , 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 04:03:14 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 E26DA33C18C; Sat, 31 Jan 2026 15:58:53 +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=1769875135; cv=none; b=S2UjAU3ABfa1wGWuJsIigwZJRiPJGVbRIWmfQiq1pZBHW2j67j/k6kYfq8tl9Cz5XBskXASUxcL7PRnf9r0sfPEw2rO60ytqG8cXsQxeExy6Pla9Yy7WRw1WF9NoPqCaZE6iwKMcRTa9CdR6JdHksRM9lwmF/FXXCDh/AWrlr6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875135; c=relaxed/simple; bh=BHMI5cZX0CNLkjeQo46La9pw6SwOIPMWy1ez9c7bmQM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z4AwohrZq+EUNFJ1yFttA4hgrIYLXiyKFwoWNzAB+gZsVxiiDJerxKhtrgLcaq0IuiFTiD9Hcjq0MCaB9xlHP/gtKpa91R17dsrchqQHtPfPVbLPhqtmdVoEFsxnd7dETq4Or5qnimEbOIDrG+FImUf3/zdDghitMC326ZZaGpY= 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=evGVxg5w; 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="evGVxg5w" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 7DC2DC22592; Sat, 31 Jan 2026 15:58:56 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 92C17606B6; Sat, 31 Jan 2026 15:58:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0B9F5119A888D; Sat, 31 Jan 2026 16:58:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875131; 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=evGVxg5wevejvO5UmMbqaVti2wZD3mHSfRVFBAd0m6DF7RSTyyo/CKzU0DMbnbRZl1cw7Z ReuBREotaJb8Vx9PcId379jMMOs04rtwJa9U6sYEqQJreepbufZgre+VsNoA7l3o4KNrom C1ZG1TkN00bOqaA0+8N16NvtFTfNOgYIgT1LXnjiwA0w8WW1N8e+yC8yIJDGdL3YWJd0cO e5K6LsgjzbLU8WBKg9DL9cY+7ZFz5kY+eqsCrjUtdFZfh0LjTo+lBosKsfo5i0OfMYR5jM /C8ozom5W3glHi0z2WPB7ns6vnL79IkQ731yWzlwlCTcbqXmb9knAdzd0gC7ag== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:34 +0100 Subject: [PATCH v2 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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-2-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , 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 04:03:14 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 0D55233D6ED for ; Sat, 31 Jan 2026 15:58:57 +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=1769875139; cv=none; b=c0Pa0+eYMvuJmIJh8KMrd3RT3kR5BAd+rFGe7CtDUjIsAO7+1X+jcTzNBFGWz40FF0i5nULQceo9yvdVsn+eTB/NwyPBX7dC6zt8/Et6TbKsNhs1+jxQ4y0zPH4z2GLXsvmxHHq54kpyccTfbwqked+VuEjJTr3rbipSsjdA1k4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875139; c=relaxed/simple; bh=bczyOOkseIGllZ1KI2kQH9CHNFzTuiU+IBawx++FApo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cRR9NqPSEGBGr+IAL7aTMPgm23IEPma0DBCM+fstoQ2g9Z75IQcP1lP00PfyiPnHfkER84rZouFg0RBEAFl8gmNEtN6inY7PUt02R4XFVZJ7FBxrS3VGJNwaK42abQhKFqJhJNlPRdWiisO4zJ5h+gck1cRzCnQ24EBAZm40qWk= 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=1ydRNdvw; 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="1ydRNdvw" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 930B01A2B5F; Sat, 31 Jan 2026 15:58:56 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 68B45606B6; Sat, 31 Jan 2026 15:58:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E32EE119A88ED; Sat, 31 Jan 2026 16:58:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875135; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=D7K4F1HrIRTsPGZNGwzk5i8tsCCw6aOJmgJvAPraxf8=; b=1ydRNdvwB7R0kZe9ZPntmALDCX7si7xmTy1IchtGSw9oszcrW9Vt3sq2TOT3gZx9uPAezZ 7xuKOFJgwqssR2HkmiHi5JUDIWrgt81+4ha3+1Dmww0vXw3oDGvVNFMNfS49o/rXLQyA1U rCcnlZLrPKpsrZSbkRHb5gbYX/dWSLdjhDJEA+Fh8faGzPDevw46hnIuG/WBmSzzzGM+47 C/X3JubjViBGxR4vl8VOEJ2F5GVn0glpiq4UJasjXXaZ9nag593Dhn46UIvXpqqag66Hm3 iD08uQFI8dvWrJtvkWMqmwVBAmjtg1Zayt9xuc8JJLWld0OKPRyB2pCiUTkT0w== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:35 +0100 Subject: [PATCH v2 3/6] drm/mcde: dsi: mcde_dsi_bind: break when a panel or bridge is found 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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-3-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , 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. There seem to be no real reason for looking for multiple panels, so just break as soon as a match is found. Signed-off-by: Luca Ceresoli Reviewed-by: Linus Walleij --- Changes in v2: - break instead of warning as suggested by Linus Walleij: https://lore.kernel.org/r/CAD++jLm_Va+7c_usgoPDhsDiCr4NQMZWsQ3iJW5-a1ETP4= EaJQ@mail.gmail.com --- drivers/gpu/drm/mcde/mcde_dsi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index a3423459dd7a..5893fd2681b3 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -1116,6 +1116,11 @@ static int mcde_dsi_bind(struct device *dev, struct = device *master, return -EINVAL; } } + + if (panel || bridge) { + of_node_put(child); + break; + } } if (panel) { bridge =3D drm_panel_bridge_add_typed(panel, --=20 2.52.0 From nobody Mon Feb 9 04:03:14 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 25CEE340DB1; Sat, 31 Jan 2026 15:59:00 +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=1769875142; cv=none; b=dWi6u389rRPb5uw4orcxsuIFlJwIQNruINTajQ3AGPh4OyoZKab6QRnocFjdZ/hFJxOB/5wNzEkq3ocoPODF66wOdz8EUullCPaTCWDg54uqNFUG4pOg1mqphageG8YCkZS46ZQ007gtC+I5v+NM+TqOUuozdXw+Y8pjKvbBzgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875142; c=relaxed/simple; bh=m2qDoKi91f3lAIwsCV6C3vIi8YqJ6O3APi5f5Uf5onY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gw6qvMTfXAE9Nc5KYhjAxNKZzCVu7gp4QXjMYKyfMHUIZJsvez56WO+VQlmfgakZqX+xil0zlgSzj3qZaU4wKUzrGu1RKEzitW85eH+qAmQdN+F6D9AGkyvLREZImN0CxOJnXIC/904+Ip8rknwMvPEmmUxvTFfSoVMyY5vVjaE= 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=fzMmmqFn; 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="fzMmmqFn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 939F2C22F7F; Sat, 31 Jan 2026 15:59:03 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AA1A1606B6; Sat, 31 Jan 2026 15:58:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9735E119A88F3; Sat, 31 Jan 2026 16:58:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875138; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=rN3xt3h5v4YQ9J23cLsAxFTBdfizY8hmnA3Lo4/tdxE=; b=fzMmmqFnipcPBSbm3bJCtchU+67qXPft4La/14Rp1esg5WA85F1cyD0Oh97WbaA3nSoQxi VC+LnwQ3RITlnkoto/J7GiN9FU3XnwV4UdDme37IAUj2xQA7pIHj0GC8uyP0T527anWvda iG+wCgUPXh7LicPwmJh2RswEAyjNkPTgVzITS6OKTBtWvhkRI3Zl7+kfZ45wgEckjOYFMT 73jSnetbMzMzy5On+HtYhvADonMZqt71mKN1PJWHXjLDrUkS5adxxiDfX6+spKAVh/aRpy 6EM9judsNxy0bqCJzMjsZeqDYNFfIWBErZI7aKzlzsc7aR7ZI6T5pZo9F+hWpQ== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:36 +0100 Subject: [PATCH v2 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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-4-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , 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 Reviewed-by: Linus Walleij --- Changes in v2: - Removed drm_bridge_put(), not needed after the previous patch changes: the loop cannot assign 'bridge' more than once now - Not added Linus' R-by because of this change --- drivers/gpu/drm/mcde/mcde_dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index 5893fd2681b3..47d45897ed06 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"); @@ -1109,7 +1108,7 @@ 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); + bridge =3D of_drm_find_and_get_bridge(child); if (!bridge) { dev_err(dev, "failed to find bridge\n"); of_node_put(child); @@ -1129,6 +1128,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) { @@ -1140,7 +1140,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; @@ -1160,7 +1160,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 04:03:14 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 9EDFE33D51A; Sat, 31 Jan 2026 15:59:04 +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=1769875146; cv=none; b=q98ndGw5LJ3EOFdVVgRcyHGdr2/Mp2xELPu3TtBISfOn1Jrgvo1u91N4kmbErUMQ+OLHlBWzgcpasrIvmKE+Z2ty9JZfcP88W8rBM2fsWVLxXKyVNNGxJOAFgBdQfLcwnsSU61zunAGduUPZa4nS+5hwCCcwSO4PVcSAT4Lbh/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875146; c=relaxed/simple; bh=ShRFWf1YL24jawc7E6qTAvPINLwJqZZgNut/y12/vXY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fe7lRQLMwMXWBTUttUH0CBz+pjGNnJGufVhnsZMpC1tUYIW4u8xqRv7BpLMnRAK6zxVvpPvuANuZvuXDwRD/sbmywX1JusLOwWaPqn/14RG0FYR7bHLC6PpB0FUvmcLN/oOjKNYPaf6K5l5Mmel+EWMB7GqQ9dRSFwjyxEaFdFk= 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=ezC+x05o; 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="ezC+x05o" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 524174E4237A; Sat, 31 Jan 2026 15:59:03 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2926C606B6; Sat, 31 Jan 2026 15:59:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1D78D119A88F2; Sat, 31 Jan 2026 16:58:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875141; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=IPtDTV3UxlBAHCLMExW04W6Gb1rrw7CzH5qBCtmWqiA=; b=ezC+x05orD8fpXliwA4jH50fNovOJC9+b8LTTnPBDhpw1x0a7jt7xfN85uup724fECWQi6 oYrc4T1g9gALnT+pwXIhaiU9EjroYOf1pWbKdlmxlzVD+YjyiF3c8nY19nd6s0Enfj0foH ClmlNf4Gl7P0wqqEr2eGWTCTsEJS2q4nduRKqB5IyejU7jNWWRDhX69kTT2vOjhBbpTF13 DX/e8sGZQmO/iu4epeAl0l9rKWnLTUHAHA5BBZ/JkbxYNpPDHZtnv66tZm3GDM5D2EWTpH eKriegr5zf4T/EZhvxD//aANRDIAY8tLsykze7OkFfOx1w1jr7MBsf2se2y6lQ== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:37 +0100 Subject: [PATCH v2 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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-5-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , 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 04:03:14 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 617A633985D; Sat, 31 Jan 2026 15:59:07 +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=1769875149; cv=none; b=BRAhAIJJCkVQYGsSNsUUL3rfBgJBGvWGWpnGflszKNGPSn9PDf39eNi5MOkVIiEaAo3/yRpRNBhT2LpJ1280TaE5A+SU0GWQyp8KAIEXIfC2DDigB3H9kWJMKQsfMzGe04D2PmD41Uj9jKGTTpx3x5EjTNZV/O/tZD9iIlYN6Mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769875149; c=relaxed/simple; bh=da+9ANNyk2TMvXnOxiVzC4dW2zw1HjxV8qtIsktsSF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cwSykYkmj7R6b9EaH/Lu/ojbLzKxomM5CCHyYbZeLQMKg3Z0Z+qPDpRyXmYVZXEXFx1wrZFc8J16N0xwi0+cYjGNWcPRc1gnqm0F1iY8/50lGzeFqE4NE3Ci/a3e34uyEPNsEVT2JKcAC6K6d/0K6uoifLG0OIuEocqKUpyPXF8= 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=Y3URwudm; 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="Y3URwudm" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id F2B67C22F7F; Sat, 31 Jan 2026 15:59:09 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 13C2D606B6; Sat, 31 Jan 2026 15:59:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5AFE6119A88F7; Sat, 31 Jan 2026 16:59:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769875145; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=CZGuLlcCDhUQzMpgbzcJjOknGYU49cHjJL/LspbQFv4=; b=Y3URwudmpAihtyVo6sDOnsVXMYDuEM94PMNcJzdJCxZ7iRquxX4p49y9q2FZYC5x3uSvwU 2+LwoUxXRDl6lbnox+N2uJmSAXOwNuFiXAYn/N0/fOVE63a0DWcX77o+GdbpopfYsoSfcO qXFlMo5U1gmdMZV+5eMTt1ztq68reFDIqzCe+Z0EzIuDBxmfXj5QLtrRMB7tdZfUi/uAg2 ARAF6B7SAo3a9zYrcoUNw9NXGsQ0iTmiF0HOmRdbHF6WC5V8Uey49CjGZVNM50TTFCCVaV SM02Kt62pdhYsiiRPaF1sNtegnHW6omT/ezFFjConiz7cl+mQV3/dobTluf72A== From: Luca Ceresoli Date: Sat, 31 Jan 2026 16:58:38 +0100 Subject: [PATCH v2 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: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-6-e081bcdc1467@bootlin.com> References: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> In-Reply-To: <20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-0-e081bcdc1467@bootlin.com> To: Biju Das , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Anitha Chrisanthus , 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