From nobody Thu Apr 2 15:42:58 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 EAC893B3C14 for ; Wed, 18 Mar 2026 09:40:58 +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=1773826865; cv=none; b=iB7YWivAj9Z4Dfo4C7pK7zdljk6PIR/hgtbx28L/5kh2du9zgryuR9BnxGikdfMJsDUX5NBnzt+C9VzkaQ5j+WC0vsvfgE46MnQJ7t7wEoY4yxp3C+VlXUgVDi73hBg+t/369bjR5ubGnBXEPVuzcR+iwTuyOexoSta7OcMKbX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773826865; c=relaxed/simple; bh=McKThli04KYh/fzxlkci2mqWS+3gqMsjSWnHCqrlI2Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NFu9xVfyDnpAzqNnPcTYbPCYBdl3c/mA+hkCJbHd7zK2IAQRZ49MhIPtYFr7w/dM1kKkYdT+68oU7+cfdBqVBhL0W+PP8G08MsSHipijQxOmcCWRglK9t/pgzm83QLmSbuZo+76ChFvaGuSA/hh9xOOE+bfjz4JuKdo+3vNI/nM= 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=VRX2j7y+; 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="VRX2j7y+" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id D0235C55069; Wed, 18 Mar 2026 09:41:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 65B9F6004F; Wed, 18 Mar 2026 09:40:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BB5AA1045074A; Wed, 18 Mar 2026 10:39:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773826795; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MP/iWAakjmG3b9NZZKNKYynkJykCtkT3XZdZkipyFNU=; b=VRX2j7y+yGFj268YoXTVxObgY8v6hlNpSe7RZchKlQEK9s8y4mP6XVNZRpfQke4cv8q1rx h93govWf/CynHPZAoEp95IJoElMAC6TJ4WUUqJrDvPHqu2mANRBYnYbiWsYPkGLb9IWE3x Vfcc9AXEArF0ZxUCegA2eFwdXCeSn7+exmdVlvAP38VM9mySffATzsnPmKSlnkomzghKqM vRwD+JrnjO/eObvp181T4hfTj6S5LtJnE5aa9U7i8K4a/2UpAa32qDxFDDYFvPjT+PcZGl F8ADhopKy5TqXpeHu+odAuXINzDm0hRn2cMXgvyEtarlPGVhidxfHlIt4gldrg== From: Luca Ceresoli Date: Wed, 18 Mar 2026 10:39:35 +0100 Subject: [PATCH v3 1/4] 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: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-1-10f502520357@bootlin.com> References: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@bootlin.com> In-Reply-To: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@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.53.0 From nobody Thu Apr 2 15:42:58 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 2DF3C378807 for ; Wed, 18 Mar 2026 09:40:03 +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=1773826811; cv=none; b=i65R3Fx0fWIZyLrKnXg0Sn5A9v05dxgzUjF7z3gl0PlvJU6bjrR8WBRNbU9qt1WZbXN6tI2RIMpZlDAQMExkOlkfHamuujfLgcRBzZC3Sj/bQ3n9UkfcV0gswkoruieVzi36IZ3b+P7nJonDhBvnBpKNyncr1NN1QkO+om+tlk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773826811; c=relaxed/simple; bh=1Im8S6jtLTEPIZHXUvTz/t/ZBSn+UlzYRoKYUPn+VKk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RgzCnNbnut6WfxLGcPHL4i+z54ZmkLMbIjWhhzGvrl7LXl102MxRoogmA/M+bMlBMGIFeNQ1trvjzsi8g0iMsfGUZowWDOuI8coRGdijUfLqKiF4kOEepAQOOPY2zD+6ehXni3ksQUkEkpFcEv0H7cUesy677lB1vy1uio8O/Wg= 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=zPV2Z3rJ; 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="zPV2Z3rJ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id EC1B74E426E6; Wed, 18 Mar 2026 09:40:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id C1A326004F; Wed, 18 Mar 2026 09:40:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0BC731045074C; Wed, 18 Mar 2026 10:39:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773826799; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=xkg8WT1H4nXO5fcJJ7+qnjT9Yuxy0/lZMRRqi782Ryk=; b=zPV2Z3rJuNSZkPd9gOJqeKkFsIPIaDMYXuF/l5srNk0O1Vi0TQc2OgiLEU9L55DBl9NybK Xkl8cFqI5JR6C9CdbYq7UGDrq+P+zxL9Si5j6vJ1bfn6A5NEdMiTH4NRslSieBaY6lTrm1 D3pCgPV+M8s/vTnNCND4l3wW2l8xcNC563XKe+MWgjcqP4rJUeZEE1Om0BEnMg/Gxgs2nf 6xSwQEWV7zsq6jpgeiLqwBs49lzFWsHReuziJM8p9UHiYkncsja7Lvdggls8Ly/msfLwNI tIfdTL6EGo5g3AzhdwSRoRBvbji/UCy9p40kiFgQWoZ4Gz5rQaITLBSEKsY5Hg== From: Luca Ceresoli Date: Wed, 18 Mar 2026 10:39:36 +0100 Subject: [PATCH v3 2/4] 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: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-2-10f502520357@bootlin.com> References: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@bootlin.com> In-Reply-To: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@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 aeb2f9f98f23..febca939bd01 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.53.0 From nobody Thu Apr 2 15:42:58 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 365EF3B8BC7 for ; Wed, 18 Mar 2026 09:40:05 +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=1773826816; cv=none; b=L398HD5QTd2dMOpqv/ofznVx2yHMhZ9vY0PDcyDIt2I468tOmmno7U3Fa9W9Aq7CVCFbP7nXndILH4vz8k1xei1O+obhhfuuAK6mt9GRjsFvB4OiWtY5Knr/S3SXapAEV9kYxweMd9Y+TecI1wj8+BoM6w6b2KeDbIEEk/r7rKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773826816; c=relaxed/simple; bh=MVUDaqOfgQycHb2ddGb/SC9aXYHHNJKQyNhAiHfmmww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qW1rHLS/psmxXQ4s8CQe3DRhSPW5jlrqbXpZ0GA/oOwi3ZrEDoIGDuYJOHhaqhTv8RgYlUb4ZDLRlD9f3WhgGYYLRk4eAL3Qfp376VCxyL35QCCHSZsO6CTzuOziF9LmNXzPSd3jTqRDX3ntDYVVO+DDQBHHmj7W/Y5MFqpA/7k= 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=QGOeY3/a; 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="QGOeY3/a" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5EA7D4E426E5; Wed, 18 Mar 2026 09:40:03 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 321326004F; Wed, 18 Mar 2026 09:40:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BB68F1045074E; Wed, 18 Mar 2026 10:39:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773826802; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=0z8qKpopfs6gFPPdyBXSHsk4IPpuxKpwOEmlP0SdwBc=; b=QGOeY3/axs43mB6kjL0lOWstNuK7SK3kImLtHkNfT9GN3XYBOBFKy8NFo6yGVgTUGgejiC PMfSuhCIm/8yj6AR5n3NPKxbf/1ss0CGFwxrD2fgEh6zwAd4emq9pxmOSWwdsOUt4/2jDy 6ZtqMRvkdZITo+WzymSMoK+J+X3bCp2N4Y5IlFm1Ugs5OjwWHanbmyBvdDv6bH4jY+eiPy 1yCspVt3WQKx956QOm9gZSpVBr/7YlbjbV8nOpm+fi1HC+qqo8igUVDskcJdXRUQo41x1B C4tvbhjQ/Elh1/X5t5EmCyl/jWlluqEnqeRbizdP3LjoP2bGvBZwpFn7tdrFiA== From: Luca Ceresoli Date: Wed, 18 Mar 2026 10:39:37 +0100 Subject: [PATCH v3 3/4] 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: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-3-10f502520357@bootlin.com> References: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@bootlin.com> In-Reply-To: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@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 60e6f43b8ab2..82d16a999ee6 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.53.0 From nobody Thu Apr 2 15:42:58 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 03BD83B8D46 for ; Wed, 18 Mar 2026 09:40: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=1773826814; cv=none; b=r0nN9B8X0hoJIYB/de/cfRaa+euUMcG3CnugG1L1/Ijx2XWbOfTjOFodNpK8tvdAu2sDrhQBWfMo+hcHc9rYU04iMSS6HyZ3d+LmZQUleXqqcE/icHl84V2yhb8R0JQtz1v0jx4011KUUGNJ7Q4nKO4HJs5JqQyYHhqHGBcEHZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773826814; c=relaxed/simple; bh=1u532q42fUwRFhVkdE0Q2Hq9LNvaZw+mAxBWSN7guBA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TGbFPFvItvoN6XbPAnxrYcsxxO2YXSYRg7afI0vj0Ukp6wuWhrWY2nzQpsc+lDhQiUamdMDswNUC1hNBjbSEiVHB8v5h4Y6rxsCVTJtEF3Z4/8KQqjG4pzDswD7FWwfUtVLrZSNXPmiVVdyo1moPogwI4UtaeBPoqHJrsEY9IRA= 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=rtGQSrON; 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="rtGQSrON" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 922E4C55069; Wed, 18 Mar 2026 09:40:30 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2745B6004F; Wed, 18 Mar 2026 09:40:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7EDDF1045072A; Wed, 18 Mar 2026 10:40:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773826805; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=gw9IiX9wHuJVqEPWrO12es2autsBEVAbQ9Q/0yqHv7s=; b=rtGQSrONPEXimZ2BBvhYe4h5DGLpaG/xtUhrhCIGE1xA66fNpUcHkeIVfaxKOh+b38TbND SDPCdVm3z6YSzP12ZojCFqAWdhuChGYrEU54rV0vlfiZ2a4ZmLkVcy7mgGcJ/10692N3cG NYEyRqVIbNeJ2RYgiJ6p7etj7iJvVHiJZI/oifkqKhcEf5li6fnsrpVmjgCdyfK7jq0ZdT DIQ2fbEQ1aqZPSUoeaH1THYkeeJ/U1/2q0vpowhR1G9bAtvkV0M2hI4rQpt0Xr83m+9Vq/ +S1l1xzpi8QvpNAvOrCiV+wRyemVkQ4URGJAPw0M9Ir1+cBdePhdY8ly0yY6RQ== From: Luca Ceresoli Date: Wed, 18 Mar 2026 10:39:38 +0100 Subject: [PATCH v3 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: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-4-10f502520357@bootlin.com> References: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@bootlin.com> In-Reply-To: <20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-0-10f502520357@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.53.0