From nobody Mon Apr 6 20:00:41 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 96F353F23B3 for ; Thu, 2 Apr 2026 16:27: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=1775147272; cv=none; b=QZsLWAKw+M93/5VTffiyN90gWdITzNPnRlsV0/OfoJMiLSa8I2J2iOXN2xEbUS5279orEOdL08q2HuFBwm++WcjPvqnIi9LS6R70+nyyM2UXa98q3UEn7dJneLT00ebFPTwb2J94ODDaOAt5beAa1gg/V6oeqUJ+v2BnOG9VEMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775147272; c=relaxed/simple; bh=1u532q42fUwRFhVkdE0Q2Hq9LNvaZw+mAxBWSN7guBA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SH+jyNzd+obocCmMEESS1kUagMQg1vK0t0+N9Ik4SOiDadnKORSk5EEiSCKfFedq+5EhG6OjCfJBvt/rro7mQqC2imB1tC1qVLvREfTVRrUQmh2m8xe6GKLstzyciHo2xi4BO9T1vRbvX4Eo+GSPuK0sCRB1HnPk5BArbFbnbCA= 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=RgQaQsPz; 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="RgQaQsPz" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 445B91A3107; Thu, 2 Apr 2026 16:27:49 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1A9DE602CD; Thu, 2 Apr 2026 16:27:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5021910450295; Thu, 2 Apr 2026 18:27:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1775147267; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=gw9IiX9wHuJVqEPWrO12es2autsBEVAbQ9Q/0yqHv7s=; b=RgQaQsPzK15bu3MyXO1lc4O1Seil08CyL4AFtMHWNWNSkpT48ND8fPW/DOUiqtWOUUDssZ /xWUDeo86E8F8nbNFVNaz8UhM8pV9IRrEoW4QRyGQOhHuf7bGYdyKBRvJWssEfzkvvVStJ /4RV/dHGufPf+SjapeYH61SZ0StucBf4FTUswz0/F/xoEgnI4M6X33OwbwFIQSb5GgnaFu p3imtV3vetF6wY9SRPo4w0UdgAj7u9qV53f55fK/1C4TwRB7u+u9rKUMhVUnBMIYL8lld+ RMDx8D19SqM5H3nGNaf7eRL4juSclmBKQ4wdKXC+Zc9I5ANnj63nJfUUBc2ycQ== From: Luca Ceresoli Date: Thu, 02 Apr 2026 18:27:20 +0200 Subject: [PATCH v4 4/4] 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: <20260402-drm-bridge-alloc-getput-drm_of_find_bridge-4-v4-4-421781c8c061@bootlin.com> References: <20260402-drm-bridge-alloc-getput-drm_of_find_bridge-4-v4-0-421781c8c061@bootlin.com> In-Reply-To: <20260402-drm-bridge-alloc-getput-drm_of_find_bridge-4-v4-0-421781c8c061@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.15.1 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.53.0