* Claude review: drm/bridge: chrontel-ch7033: switch to of_drm_get_bridge_by_endpoint()
2026-05-04 10:45 ` [PATCH v4 05/11] drm/bridge: chrontel-ch7033: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
@ 2026-05-04 22:26 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-04 22:26 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Status: Good**
This patch takes the approach of moving to `bridge.next_bridge` (the auto-put field in `struct drm_bridge`), removing the separate `next_bridge` pointer from the driver's private struct. All usages of `priv->next_bridge` are converted to `priv->bridge.next_bridge`. This is the cleanest approach for bridge drivers that store the downstream bridge pointer for their lifetime.
The `bridge.next_bridge` field is documented as "automatically put when this bridge is freed", so no explicit cleanup is needed.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge()
@ 2026-05-11 16:40 Luca Ceresoli
2026-05-11 16:40 ` [PATCH v6 01/11] drm/bridge: drm_bridge_put(): ignore ERR_PTR Luca Ceresoli
` (11 more replies)
0 siblings, 12 replies; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Laurent Pinchart, Dmitry Baryshkov, Laurent Pinchart, Biju Das
This series converts all the bridge-only callers of the deprecated
drm_of_find_panel_or_bridge() API to a new, simpler API that handles bridge
refcounting.
All patches acked/reviewed except patches 3 and 4.
== Series description
* Patch 1 (new in v2) makes drm_bridge_put() ignore ERR_PTR pointers,
not only NULL pointers
* Patch 2 introduces of_drm_get_bridge_by_endpoint() as a replacement for
bridge-only calls to drm_of_find_panel_or_bridge(); the new function
refcounts the bridge and is simpler
* The following patches convert all bridge-only users to the new API
* The last patch forbids new bridge-only calls to
drm_of_find_panel_or_bridge()
== Grand plan
This is part of the work to support hotplug of DRM bridges. The grand plan
was discussed in [0].
Here's the work breakdown (➜ marks the current series):
1. ➜ add refcounting to DRM bridges struct drm_bridge,
based on devm_drm_bridge_alloc()
A. ✔ add new alloc API and refcounting (v6.16)
B. ✔ convert all bridge drivers to new API (v6.17)
C. ✔ kunit tests (v6.17)
D. ✔ add get/put to drm_bridge_add/remove() + attach/detach()
and warn on old allocation pattern (v6.17)
E. ➜ add get/put on drm_bridge accessors
1. ✔ drm_bridge_chain_get_first_bridge(), add cleanup action (v6.18)
2. ✔ drm_bridge_get_prev_bridge() (v6.18)
3. ✔ drm_bridge_get_next_bridge() (v6.19)
4. ✔ drm_for_each_bridge_in_chain() (v6.19)
5. ✔ drm_bridge_connector_init (v6.19)
6. ✔ protect encoder bridge chain with a mutex (v7.2)
7. ➜ of_drm_find_bridge
a. ✔ add of_drm_get_bridge() (v7.0),
convert basic direct users (v7.0-v7.1)
b. ✔ convert direct of_drm_get_bridge() users, part 2 (v7.0)
c. ✔ convert direct of_drm_get_bridge() users, part 3 (v7.0)
d. ✔ convert direct of_drm_get_bridge() users, part 4 (v7.1-v7.2)
e. ➜ convert bridge-only drm_of_find_panel_or_bridge() users
8. drm_of_find_panel_or_bridge, *_of_get_bridge
9. ✔ enforce drm_bridge_add before drm_bridge_attach (v6.19)
F. ✔ debugfs improvements
1. ✔ add top-level 'bridges' file (v6.16)
2. ✔ show refcount and list lingering bridges (v6.19)
2. … handle gracefully atomic updates during bridge removal
A. ✔ Add drm_bridge_enter/exit() to protect device resources (v7.0)
B. … protect private_obj removal from list
C. ✔ Add drm_bridge_clear_and_put() (v7.1)
3. … DSI host-device driver interaction
4. ✔ removing the need for the "always-disconnected" connector
5. ✔ Migrate i.MX LCDIF driver to bridge-connector (v7.2)
6. … DRM bridge hotplug
A. … Bridge hotplug management in the DRM core
1. ✔ bridge-connector: attach encoder to the connector (v7.2)
B. Device tree description
[0] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/#t
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v6:
- Patch 2: fix warning in the no-OF case
- Patch 3: fix too-late next_bridge assignment
- Link to v5: https://patch.msgid.link/20260507-drm-bridge-alloc-getput-panel_or_bridge-v5-0-472b913b5cb7@bootlin.com
Changes in v5:
- Patch 1: change drm_bridge_put() only
- Patches 3,10: simplify error management code flow
- Link to v4: https://patch.msgid.link/20260504-drm-bridge-alloc-getput-panel_or_bridge-v4-0-b578c3daaf10@bootlin.com
Changes in v4:
- Fixed patches 3 and 10
- Minor fixes to patches 1 and 2
- Removed bouncing addresses yongqin.liu@linaro.org and
xinliang.liu@linaro.org from Cc
- Link to v3: https://patch.msgid.link/20260428-drm-bridge-alloc-getput-panel_or_bridge-v3-0-a537b5567add@bootlin.com
Changes in v3:
- patch 3, 8, 10: fixed ERR_PTR deref in the -ENODEV case, and removed
Dmitry's R-by from those patches as they are changed
- Added review trailers to the other patches
- Link to v2: https://patch.msgid.link/20260428-drm-bridge-alloc-getput-panel_or_bridge-v2-0-4300744a1c47@bootlin.com
Changes in v2:
- Added patch to ignore ERR_PTR values in drm_bridge_get/put()
- Changed API to return the bridge (or a ERR_PTR) in the return value,
not as a double-pointer output parameter
- Adapted all patches to the new API, dropped Dmitry's review tags as the
patches are all modified
- Removed bouncing addresses from Cc list
- Link to v1: https://patch.msgid.link/20260413-drm-bridge-alloc-getput-panel_or_bridge-v1-0-acd01cd79a1f@bootlin.com
---
Luca Ceresoli (11):
drm/bridge: drm_bridge_put(): ignore ERR_PTR
drm/bridge: add of_drm_get_bridge_by_endpoint()
drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint()
drm/hisilicon/kirin: switch to of_drm_get_bridge_by_endpoint()
drm/bridge: chrontel-ch7033: switch to of_drm_get_bridge_by_endpoint()
drm/bridge: lontium-lt9611uxc: switch to of_drm_get_bridge_by_endpoint()
drm/bridge: lt9611: switch to of_drm_get_bridge_by_endpoint()
drm/bridge: adv7511: switch to of_drm_get_bridge_by_endpoint()
drm/bridge: lt8713sx: switch to of_drm_get_bridge_by_endpoint()
drm: zynqmp_dp: switch to of_drm_get_bridge_by_endpoint()
drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge()
drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 -
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 15 +++---
drivers/gpu/drm/bridge/chrontel-ch7033.c | 28 ++++++-----
drivers/gpu/drm/bridge/lontium-lt8713sx.c | 10 ++--
drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++--
drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 9 ++--
drivers/gpu/drm/drm_bridge.c | 45 +++++++++++++++++-
drivers/gpu/drm/drm_of.c | 26 +++++------
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 9 ++--
drivers/gpu/drm/msm/hdmi/hdmi.c | 70 +++++++++++++++++++---------
drivers/gpu/drm/xlnx/zynqmp_dp.c | 19 ++++----
include/drm/drm_bridge.h | 7 +++
12 files changed, 162 insertions(+), 86 deletions(-)
---
base-commit: 7af78cfbe2b47cd9ecb61480fb74d64b584d8a94
change-id: 20260410-drm-bridge-alloc-getput-panel_or_bridge-42501b38eaad
Best regards,
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v6 01/11] drm/bridge: drm_bridge_put(): ignore ERR_PTR
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 02/11] drm/bridge: add of_drm_get_bridge_by_endpoint() Luca Ceresoli
` (10 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Laurent Pinchart, Dmitry Baryshkov, Laurent Pinchart
Most functions returning a struct drm_bridge pointer currently return a
valid pointer or NULL, but this restricts their ability to return an error
code as an ERR_PTR describing the error kind.
In preparation to have new APIs that can return a struct drm_bridge pointer
holding an ERR_PTR (and for those which already do) make drm_bridge_put()
ignore ERR_PTR values, just like it ignores NULL pointers.
This will avoid annoying error checking in many places and the risk of
missing error checks.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/all/20260318152533.GA633439@killaraus.ideasonboard.com/
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/all/omlnswxukeqgnatzdvooaashgkfcacjevkvbkm6xt33itgua2k@jcmzll2w6kdq/
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v5:
- don't change drm_bridge_get(), only drm_bridge_put() has known use cases
Changes in v4:
- removed incorrect change to drm_bridge_clear_and_put() kdoc
Patch added in v2
---
drivers/gpu/drm/drm_bridge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index ce180f0b26b2..b46c01db8d83 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -300,7 +300,7 @@ EXPORT_SYMBOL(drm_bridge_get);
/**
* drm_bridge_put - Release a bridge reference
- * @bridge: DRM bridge; if NULL this function does nothing
+ * @bridge: DRM bridge; if NULL or an ERR_PTR this function does nothing
*
* This function decrements the bridge's reference count and frees the
* object if the reference count drops to zero.
@@ -310,7 +310,7 @@ EXPORT_SYMBOL(drm_bridge_get);
*/
void drm_bridge_put(struct drm_bridge *bridge)
{
- if (bridge)
+ if (!IS_ERR_OR_NULL(bridge))
kref_put(&bridge->refcount, __drm_bridge_free);
}
EXPORT_SYMBOL(drm_bridge_put);
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 02/11] drm/bridge: add of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-11 16:40 ` [PATCH v6 01/11] drm/bridge: drm_bridge_put(): ignore ERR_PTR Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
` (9 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Dmitry Baryshkov, Laurent Pinchart
drm_of_find_panel_or_bridge() is widely used, but many callers pass NULL
into the @panel or the @bridge arguments, thus making a very partial usage
of this rather complex function.
Besides, the bridge returned in @bridge is not refcounted, thus making this
API unsafe when DRM bridge hotplug will be introduced.
Solve both issues for the cases of calls to drm_of_find_panel_or_bridge()
with a NULL @panel pointer by adding a new function that only looks for
bridges (and is thus much simpler) and increments the refcount of the
returned bridge.
The new function is identical to drm_of_find_panel_or_bridge() except it:
- handles bridge refcounting: uses of_drm_find_and_get_bridge() instead of
of_drm_find_bridge() internally to return a refcounted bridge
- is simpler to use: just takes no @panel parameter, returns the pointer
in the return value instead of a double pointer argument
- has a simpler implementation: it is equal to
drm_of_find_panel_or_bridge() after removing the code that becomes dead
when @panel == NULL
Also add this function to drm_bridge.c and not drm_of.c because it returns
bridges only.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v5:
- add missing ERR_PTR() in return statement for no-OF inline variant
Changes in v4:
- update function declaration in non-OF case
- fix grammar in comment
Changes in v2:
- return the bridge in the return value, not a double pointer
---
drivers/gpu/drm/drm_bridge.c | 41 +++++++++++++++++++++++++++++++++++++++++
include/drm/drm_bridge.h | 7 +++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index b46c01db8d83..687b36eea0c7 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1582,6 +1582,47 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np)
return bridge;
}
EXPORT_SYMBOL(of_drm_find_bridge);
+
+/**
+ * of_drm_get_bridge_by_endpoint - return DRM bridge connected to a port/endpoint
+ * @np: device tree node containing output ports
+ * @port: port in the device tree node, or -1 for the first port found
+ * @endpoint: endpoint in the device tree node, or -1 for the first endpoint found
+ *
+ * Given a DT node's port and endpoint number, find the connected node and
+ * return the associated drm_bridge device.
+ *
+ * The refcount of the returned bridge is incremented. Use drm_bridge_put()
+ * when done with it.
+ *
+ * Returns a pointer to the connected drm_bridge, or a negative error on failure
+ */
+struct drm_bridge *of_drm_get_bridge_by_endpoint(const struct device_node *np,
+ int port, int endpoint)
+{
+ struct drm_bridge *bridge;
+
+ /*
+ * of_graph_get_remote_node() produces a noisy error message if port
+ * node isn't found and the absence of the port is a legit case here,
+ * so at first we silently check whether graph is present in the
+ * device-tree node.
+ */
+ if (!of_graph_is_present(np))
+ return ERR_PTR(-ENODEV);
+
+ struct device_node *remote __free(device_node) =
+ of_graph_get_remote_node(np, port, endpoint);
+ if (!remote)
+ return ERR_PTR(-ENODEV);
+
+ bridge = of_drm_find_and_get_bridge(remote);
+ if (!bridge)
+ return ERR_PTR(-EPROBE_DEFER);
+
+ return bridge;
+}
+EXPORT_SYMBOL_GPL(of_drm_get_bridge_by_endpoint);
#endif
/**
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index fdac9a526f38..4ba3a5deef9a 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -1327,6 +1327,8 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
#ifdef CONFIG_OF
struct drm_bridge *of_drm_find_and_get_bridge(struct device_node *np);
struct drm_bridge *of_drm_find_bridge(struct device_node *np);
+struct drm_bridge *of_drm_get_bridge_by_endpoint(const struct device_node *np,
+ int port, int endpoint);
#else
static inline struct drm_bridge *of_drm_find_and_get_bridge(struct device_node *np)
{
@@ -1336,6 +1338,11 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
{
return NULL;
}
+static inline struct drm_bridge *of_drm_get_bridge_by_endpoint(const struct device_node *np,
+ int port, int endpoint)
+{
+ return ERR_PTR(-ENODEV);
+}
#endif
static inline bool drm_bridge_is_last(struct drm_bridge *bridge)
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-11 16:40 ` [PATCH v6 01/11] drm/bridge: drm_bridge_put(): ignore ERR_PTR Luca Ceresoli
2026-05-11 16:40 ` [PATCH v6 02/11] drm/bridge: add of_drm_get_bridge_by_endpoint() Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-13 13:24 ` Dmitry Baryshkov
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 04/11] drm/hisilicon/kirin: " Luca Ceresoli
` (8 subsequent siblings)
11 siblings, 2 replies; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v6:
- move assignment of next_bridge earlier (avoid access before assignment)
Changes in v5:
- simplify error management code flow
Changes in v4:
- ensure next_bridge is put on later probe failures
Changes in v3:
- fix ERR_PTR deref when -ENODEV is returned
- move assignment of next_bridge earlier (avoid access before assignment)
---
drivers/gpu/drm/msm/hdmi/hdmi.c | 70 +++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index d9491aac1a89..474006084633 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -285,19 +285,27 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
spin_lock_init(&hdmi->reg_lock);
mutex_init(&hdmi->state_mutex);
- ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
- if (ret && ret != -ENODEV)
- return ret;
+ hdmi->next_bridge = of_drm_get_bridge_by_endpoint(dev_of_node(dev), 1, 0);
+ if (IS_ERR(hdmi->next_bridge)) {
+ if (PTR_ERR(hdmi->next_bridge) != -ENODEV)
+ return PTR_ERR(hdmi->next_bridge);
+
+ hdmi->next_bridge = NULL;
+ }
hdmi->mmio = msm_ioremap(pdev, "core_physical");
- if (IS_ERR(hdmi->mmio))
- return PTR_ERR(hdmi->mmio);
+ if (IS_ERR(hdmi->mmio)) {
+ ret = PTR_ERR(hdmi->mmio);
+ goto err_put_bridge;
+ }
/* HDCP needs physical address of hdmi register */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"core_physical");
- if (!res)
- return -EINVAL;
+ if (!res) {
+ ret = -EINVAL;
+ goto err_put_bridge;
+ }
hdmi->mmio_phy_addr = res->start;
hdmi->qfprom_mmio = msm_ioremap(pdev, "qfprom_physical");
@@ -307,45 +315,58 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
}
hdmi->irq = platform_get_irq(pdev, 0);
- if (hdmi->irq < 0)
- return hdmi->irq;
+ if (hdmi->irq < 0) {
+ ret = hdmi->irq;
+ goto err_put_bridge;
+ }
hdmi->pwr_regs = devm_kcalloc(dev, config->pwr_reg_cnt,
sizeof(hdmi->pwr_regs[0]),
GFP_KERNEL);
- if (!hdmi->pwr_regs)
- return -ENOMEM;
+ if (!hdmi->pwr_regs) {
+ ret = -ENOMEM;
+ goto err_put_bridge;
+ }
for (i = 0; i < config->pwr_reg_cnt; i++)
hdmi->pwr_regs[i].supply = config->pwr_reg_names[i];
ret = devm_regulator_bulk_get(dev, config->pwr_reg_cnt, hdmi->pwr_regs);
- if (ret)
- return dev_err_probe(dev, ret, "failed to get pwr regulators\n");
+ if (ret) {
+ dev_err_probe(dev, ret, "failed to get pwr regulators\n");
+ goto err_put_bridge;
+ }
hdmi->pwr_clks = devm_kcalloc(dev, config->pwr_clk_cnt,
sizeof(hdmi->pwr_clks[0]),
GFP_KERNEL);
- if (!hdmi->pwr_clks)
- return -ENOMEM;
+ if (!hdmi->pwr_clks) {
+ ret = -ENOMEM;
+ goto err_put_bridge;
+ }
for (i = 0; i < config->pwr_clk_cnt; i++)
hdmi->pwr_clks[i].id = config->pwr_clk_names[i];
ret = devm_clk_bulk_get(dev, config->pwr_clk_cnt, hdmi->pwr_clks);
if (ret)
- return ret;
+ goto err_put_bridge;
+
hdmi->extp_clk = devm_clk_get_optional(dev, "extp");
- if (IS_ERR(hdmi->extp_clk))
- return dev_err_probe(dev, PTR_ERR(hdmi->extp_clk),
- "failed to get extp clock\n");
+ if (IS_ERR(hdmi->extp_clk)) {
+ ret = dev_err_probe(dev, PTR_ERR(hdmi->extp_clk),
+ "failed to get extp clock\n");
+ goto err_put_bridge;
+ }
hdmi->hpd_gpiod = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN);
/* This will catch e.g. -EPROBE_DEFER */
- if (IS_ERR(hdmi->hpd_gpiod))
- return dev_err_probe(dev, PTR_ERR(hdmi->hpd_gpiod),
- "failed to get hpd gpio\n");
+ if (IS_ERR(hdmi->hpd_gpiod)) {
+ ret = dev_err_probe(dev, PTR_ERR(hdmi->hpd_gpiod),
+ "failed to get hpd gpio\n");
+ goto err_put_bridge;
+ }
if (!hdmi->hpd_gpiod)
DBG("failed to get HPD gpio");
@@ -355,7 +376,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
ret = msm_hdmi_get_phy(hdmi);
if (ret)
- return ret;
+ goto err_put_bridge;
ret = devm_pm_runtime_enable(dev);
if (ret)
@@ -371,6 +392,8 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
err_put_phy:
msm_hdmi_put_phy(hdmi);
+err_put_bridge:
+ drm_bridge_put(hdmi->next_bridge);
return ret;
}
@@ -381,6 +404,7 @@ static void msm_hdmi_dev_remove(struct platform_device *pdev)
component_del(&pdev->dev, &msm_hdmi_ops);
msm_hdmi_put_phy(hdmi);
+ drm_bridge_put(hdmi->next_bridge);
}
static int msm_hdmi_runtime_suspend(struct device *dev)
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 04/11] drm/hisilicon/kirin: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (2 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 05/11] drm/bridge: chrontel-ch7033: " Luca Ceresoli
` (7 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. Here the bridge pointer is
only stored in a temporary variable, so a cleanup action is enough.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index e80debdc4176..ab3cd309505a 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -778,17 +778,16 @@ static int dsi_host_init(struct device *dev, struct dw_dsi *dsi)
static int dsi_bridge_init(struct drm_device *dev, struct dw_dsi *dsi)
{
struct drm_encoder *encoder = &dsi->encoder;
- struct drm_bridge *bridge;
+ struct drm_bridge *bridge __free(drm_bridge_put) = NULL;
struct device_node *np = dsi->dev->of_node;
- int ret;
/*
* Get the endpoint node. In our case, dsi has one output port1
* to which the external HDMI bridge is connected.
*/
- ret = drm_of_find_panel_or_bridge(np, 1, 0, NULL, &bridge);
- if (ret)
- return ret;
+ bridge = of_drm_get_bridge_by_endpoint(np, 1, 0);
+ if (IS_ERR(bridge))
+ return PTR_ERR(bridge);
/* associate the bridge to dsi encoder */
return drm_bridge_attach(encoder, bridge, NULL, 0);
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 05/11] drm/bridge: chrontel-ch7033: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (3 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 04/11] drm/hisilicon/kirin: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 06/11] drm/bridge: lontium-lt9611uxc: " Luca Ceresoli
` (6 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Dmitry Baryshkov
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/chrontel-ch7033.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/bridge/chrontel-ch7033.c b/drivers/gpu/drm/bridge/chrontel-ch7033.c
index 54d49d4882c8..a237c65ebd69 100644
--- a/drivers/gpu/drm/bridge/chrontel-ch7033.c
+++ b/drivers/gpu/drm/bridge/chrontel-ch7033.c
@@ -199,7 +199,6 @@ enum {
struct ch7033_priv {
struct regmap *regmap;
- struct drm_bridge *next_bridge;
struct drm_bridge bridge;
struct drm_connector connector;
};
@@ -215,7 +214,7 @@ static enum drm_connector_status ch7033_connector_detect(
{
struct ch7033_priv *priv = conn_to_ch7033_priv(connector);
- return drm_bridge_detect(priv->next_bridge, connector);
+ return drm_bridge_detect(priv->bridge.next_bridge, connector);
}
static const struct drm_connector_funcs ch7033_connector_funcs = {
@@ -233,7 +232,7 @@ static int ch7033_connector_get_modes(struct drm_connector *connector)
const struct drm_edid *drm_edid;
int ret;
- drm_edid = drm_bridge_edid_read(priv->next_bridge, connector);
+ drm_edid = drm_bridge_edid_read(priv->bridge.next_bridge, connector);
drm_edid_connector_update(connector, drm_edid);
if (drm_edid) {
ret = drm_edid_connector_add_modes(connector);
@@ -275,7 +274,7 @@ static int ch7033_bridge_attach(struct drm_bridge *bridge,
struct drm_connector *connector = &priv->connector;
int ret;
- ret = drm_bridge_attach(encoder, priv->next_bridge, bridge,
+ ret = drm_bridge_attach(encoder, priv->bridge.next_bridge, bridge,
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (ret)
return ret;
@@ -283,15 +282,15 @@ static int ch7033_bridge_attach(struct drm_bridge *bridge,
if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
return 0;
- if (priv->next_bridge->ops & DRM_BRIDGE_OP_DETECT) {
+ if (priv->bridge.next_bridge->ops & DRM_BRIDGE_OP_DETECT) {
connector->polled = DRM_CONNECTOR_POLL_HPD;
} else {
connector->polled = DRM_CONNECTOR_POLL_CONNECT |
DRM_CONNECTOR_POLL_DISCONNECT;
}
- if (priv->next_bridge->ops & DRM_BRIDGE_OP_HPD) {
- drm_bridge_hpd_enable(priv->next_bridge, ch7033_hpd_event,
+ if (priv->bridge.next_bridge->ops & DRM_BRIDGE_OP_HPD) {
+ drm_bridge_hpd_enable(priv->bridge.next_bridge, ch7033_hpd_event,
priv);
}
@@ -299,8 +298,8 @@ static int ch7033_bridge_attach(struct drm_bridge *bridge,
&ch7033_connector_helper_funcs);
ret = drm_connector_init_with_ddc(bridge->dev, &priv->connector,
&ch7033_connector_funcs,
- priv->next_bridge->type,
- priv->next_bridge->ddc);
+ priv->bridge.next_bridge->type,
+ priv->bridge.next_bridge->ddc);
if (ret) {
DRM_ERROR("Failed to initialize connector\n");
return ret;
@@ -313,8 +312,8 @@ static void ch7033_bridge_detach(struct drm_bridge *bridge)
{
struct ch7033_priv *priv = bridge_to_ch7033_priv(bridge);
- if (priv->next_bridge->ops & DRM_BRIDGE_OP_HPD)
- drm_bridge_hpd_disable(priv->next_bridge);
+ if (priv->bridge.next_bridge->ops & DRM_BRIDGE_OP_HPD)
+ drm_bridge_hpd_disable(priv->bridge.next_bridge);
drm_connector_cleanup(&priv->connector);
}
@@ -543,10 +542,9 @@ static int ch7033_probe(struct i2c_client *client)
dev_set_drvdata(dev, priv);
- ret = drm_of_find_panel_or_bridge(dev->of_node, 1, -1, NULL,
- &priv->next_bridge);
- if (ret)
- return ret;
+ priv->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 1, -1);
+ if (IS_ERR(priv->bridge.next_bridge))
+ return PTR_ERR(priv->bridge.next_bridge);
priv->regmap = devm_regmap_init_i2c(client, &ch7033_regmap_config);
if (IS_ERR(priv->regmap)) {
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 06/11] drm/bridge: lontium-lt9611uxc: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (4 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 05/11] drm/bridge: chrontel-ch7033: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 07/11] drm/bridge: lt9611: " Luca Ceresoli
` (5 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Dmitry Baryshkov
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
index 11aab07d88df..9427cc2358ae 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
@@ -35,7 +35,6 @@
struct lt9611uxc {
struct device *dev;
struct drm_bridge bridge;
- struct drm_bridge *next_bridge;
struct regmap *regmap;
/* Protects all accesses to registers by stopping the on-chip MCU */
@@ -284,7 +283,7 @@ static int lt9611uxc_bridge_attach(struct drm_bridge *bridge,
{
struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
- return drm_bridge_attach(encoder, lt9611uxc->next_bridge,
+ return drm_bridge_attach(encoder, lt9611uxc->bridge.next_bridge,
bridge, flags);
}
@@ -487,7 +486,11 @@ static int lt9611uxc_parse_dt(struct device *dev,
lt9611uxc->dsi1_node = of_graph_get_remote_node(dev->of_node, 1, -1);
- return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611uxc->next_bridge);
+ lt9611uxc->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 2, -1);
+ if (IS_ERR(lt9611uxc->bridge.next_bridge))
+ return PTR_ERR(lt9611uxc->bridge.next_bridge);
+
+ return 0;
}
static int lt9611uxc_gpio_init(struct lt9611uxc *lt9611uxc)
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 07/11] drm/bridge: lt9611: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (5 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 06/11] drm/bridge: lontium-lt9611uxc: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 08/11] drm/bridge: adv7511: " Luca Ceresoli
` (4 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Dmitry Baryshkov
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 0f49b13193b9..21305296e111 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -37,7 +37,6 @@
struct lt9611 {
struct device *dev;
struct drm_bridge bridge;
- struct drm_bridge *next_bridge;
struct regmap *regmap;
@@ -761,7 +760,7 @@ static int lt9611_bridge_attach(struct drm_bridge *bridge,
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- return drm_bridge_attach(encoder, lt9611->next_bridge,
+ return drm_bridge_attach(encoder, lt9611->bridge.next_bridge,
bridge, flags);
}
@@ -1058,7 +1057,11 @@ static int lt9611_parse_dt(struct device *dev,
lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
- return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge);
+ lt9611->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 2, -1);
+ if (IS_ERR(lt9611->bridge.next_bridge))
+ return PTR_ERR(lt9611->bridge.next_bridge);
+
+ return 0;
}
static int lt9611_gpio_init(struct lt9611 *lt9611)
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 08/11] drm/bridge: adv7511: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (6 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 07/11] drm/bridge: lt9611: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 09/11] drm/bridge: lt8713sx: " Luca Ceresoli
` (3 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Biju Das, Dmitry Baryshkov, Laurent Pinchart
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.
Tested-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v3:
- fix ERR_PTR deref when -ENODEV is returned
---
drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 -
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 15 +++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h
index 8be7266fd4f4..12c95198d9a4 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
@@ -354,7 +354,6 @@ struct adv7511 {
enum drm_connector_status status;
bool powered;
- struct drm_bridge *next_bridge;
struct drm_display_mode curr_mode;
unsigned int f_tmds;
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 821a3008a1e7..02f8f7e78a16 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -849,8 +849,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,
struct adv7511 *adv = bridge_to_adv7511(bridge);
int ret = 0;
- if (adv->next_bridge) {
- ret = drm_bridge_attach(encoder, adv->next_bridge, bridge,
+ if (adv->bridge.next_bridge) {
+ ret = drm_bridge_attach(encoder, adv->bridge.next_bridge, bridge,
flags | DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (ret)
return ret;
@@ -1249,10 +1249,13 @@ static int adv7511_probe(struct i2c_client *i2c)
memset(&link_config, 0, sizeof(link_config));
- ret = drm_of_find_panel_or_bridge(dev->of_node, 1, -1, NULL,
- &adv7511->next_bridge);
- if (ret && ret != -ENODEV)
- return ret;
+ adv7511->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 1, -1);
+ if (IS_ERR(adv7511->bridge.next_bridge)) {
+ if (PTR_ERR(adv7511->bridge.next_bridge) == -ENODEV)
+ adv7511->bridge.next_bridge = NULL;
+ else
+ return PTR_ERR(adv7511->bridge.next_bridge);
+ }
if (adv7511->info->link_config)
ret = adv7511_parse_dt(dev->of_node, &link_config);
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 09/11] drm/bridge: lt8713sx: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (7 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 08/11] drm/bridge: adv7511: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 10/11] drm: zynqmp_dp: " Luca Ceresoli
` (2 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Dmitry Baryshkov
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/lontium-lt8713sx.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt8713sx.c b/drivers/gpu/drm/bridge/lontium-lt8713sx.c
index 18fac6a46db4..cee485adf5e5 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8713sx.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8713sx.c
@@ -32,7 +32,6 @@ DECLARE_CRC8_TABLE(lt8713sx_crc_table);
struct lt8713sx {
struct device *dev;
struct drm_bridge bridge;
- struct drm_bridge *next_bridge;
struct regmap *regmap;
/* Protects all accesses to registers by stopping the on-chip MCU */
@@ -458,7 +457,7 @@ static int lt8713sx_bridge_attach(struct drm_bridge *bridge,
struct lt8713sx *lt8713sx = container_of(bridge, struct lt8713sx, bridge);
return drm_bridge_attach(encoder,
- lt8713sx->next_bridge,
+ lt8713sx->bridge.next_bridge,
bridge, flags);
}
@@ -537,10 +536,9 @@ static int lt8713sx_probe(struct i2c_client *client)
if (IS_ERR(lt8713sx->regmap))
return dev_err_probe(dev, PTR_ERR(lt8713sx->regmap), "regmap i2c init failed\n");
- ret = drm_of_find_panel_or_bridge(lt8713sx->dev->of_node, 1, -1, NULL,
- <8713sx->next_bridge);
- if (ret < 0)
- return ret;
+ lt8713sx->bridge.next_bridge = of_drm_get_bridge_by_endpoint(lt8713sx->dev->of_node, 1, -1);
+ if (IS_ERR(lt8713sx->bridge.next_bridge))
+ return PTR_ERR(lt8713sx->bridge.next_bridge);
ret = lt8713sx_gpio_init(lt8713sx);
if (ret < 0)
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 10/11] drm: zynqmp_dp: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (8 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 09/11] drm/bridge: lt8713sx: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-16 5:02 ` Claude review: drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Claude Code Review Bot
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Laurent Pinchart
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v4:
- fix missing assignment
- simplify error management code flow
Changes in v3:
- fix ERR_PTR deref when -ENODEV is returned
---
drivers/gpu/drm/xlnx/zynqmp_dp.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 05bd31fe675b..7fb11b0a44f0 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -353,7 +353,6 @@ struct zynqmp_dp_train_set_priv {
* @lock: Mutex protecting this struct and register access (but not AUX)
* @irq: irq
* @bridge: DRM bridge for the DP encoder
- * @next_bridge: The downstream bridge
* @test: Configuration for test mode
* @config: IP core configuration from DTS
* @aux: aux channel
@@ -385,7 +384,6 @@ struct zynqmp_dp {
struct completion aux_done;
struct mutex lock;
- struct drm_bridge *next_bridge;
struct device *dev;
struct zynqmp_dpsub *dpsub;
void __iomem *iomem;
@@ -1494,8 +1492,8 @@ static int zynqmp_dp_bridge_attach(struct drm_bridge *bridge,
return ret;
}
- if (dp->next_bridge) {
- ret = drm_bridge_attach(encoder, dp->next_bridge,
+ if (dp->bridge.next_bridge) {
+ ret = drm_bridge_attach(encoder, dp->bridge.next_bridge,
bridge, flags);
if (ret < 0)
goto error;
@@ -2461,10 +2459,15 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
* Acquire the next bridge in the chain. Ignore errors caused by port@5
* not being connected for backward-compatibility with older DTs.
*/
- ret = drm_of_find_panel_or_bridge(dp->dev->of_node, 5, 0, NULL,
- &dp->next_bridge);
- if (ret < 0 && ret != -ENODEV)
- goto err_reset;
+ dp->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dp->dev->of_node, 5, 0);
+ if (IS_ERR(dp->bridge.next_bridge)) {
+ if (PTR_ERR(dp->bridge.next_bridge) != -ENODEV) {
+ ret = PTR_ERR(dp->bridge.next_bridge);
+ goto err_reset;
+ }
+
+ dp->bridge.next_bridge = NULL;
+ }
/* Initialize the hardware. */
dp->config.misc0 &= ~ZYNQMP_DP_MAIN_STREAM_MISC0_SYNC_LOCK;
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v6 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (9 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 10/11] drm: zynqmp_dp: " Luca Ceresoli
@ 2026-05-11 16:40 ` Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-16 5:02 ` Claude review: drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Claude Code Review Bot
11 siblings, 1 reply; 26+ messages in thread
From: Luca Ceresoli @ 2026-05-11 16:40 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek
Cc: Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel, linux-kernel,
linux-arm-msm, freedreno, linux-arm-kernel, Luca Ceresoli,
Dmitry Baryshkov, Laurent Pinchart
Up to now drm_of_find_panel_or_bridge() can be called with a bridge pointer
only, a panel pointer only, or both a bridge and a panel pointers. The
logic to handle all the three cases is somewhat complex to read however.
Now all bridge-only callers have been converted to
of_drm_get_bridge_by_endpoint(), which is simpler and handles bridge
refcounting. So forbid new bridge-only users by mandating a non-NULL panel
pointer in the docs and in the sanity checks along with a warning.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/drm_of.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index ef6b09316963..d03ada82eac9 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -225,15 +225,15 @@ EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
* @np: device tree node containing encoder output ports
* @port: port in the device tree node
* @endpoint: endpoint in the device tree node
- * @panel: pointer to hold returned drm_panel
+ * @panel: pointer to hold returned drm_panel, must not be NULL
* @bridge: pointer to hold returned drm_bridge
*
* Given a DT node's port and endpoint number, find the connected node and
- * return either the associated struct drm_panel or drm_bridge device. Either
- * @panel or @bridge must not be NULL.
+ * return either the associated struct drm_panel or drm_bridge device.
*
* This function is deprecated and should not be used in new drivers. Use
- * devm_drm_of_get_bridge() instead.
+ * of_drm_get_bridge_by_endpoint() instead when not looking for a panel, or
+ * devm_drm_of_get_bridge() otherwise.
*
* Returns zero if successful, or one of the standard error codes if it fails.
*/
@@ -245,10 +245,10 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
int ret = -EPROBE_DEFER;
struct device_node *remote;
- if (!panel && !bridge)
+ if (WARN_ON(!panel))
return -EINVAL;
- if (panel)
- *panel = NULL;
+
+ *panel = NULL;
/*
* of_graph_get_remote_node() produces a noisy error message if port
@@ -263,13 +263,11 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
if (!remote)
return -ENODEV;
- if (panel) {
- *panel = of_drm_find_panel(remote);
- if (!IS_ERR(*panel))
- ret = 0;
- else
- *panel = NULL;
- }
+ *panel = of_drm_find_panel(remote);
+ if (!IS_ERR(*panel))
+ ret = 0;
+ else
+ *panel = NULL;
if (bridge) {
if (ret) {
--
2.54.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
@ 2026-05-13 13:24 ` Dmitry Baryshkov
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
1 sibling, 0 replies; 26+ messages in thread
From: Dmitry Baryshkov @ 2026-05-13 13:24 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Clark,
Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
Marijn Suijten, Sumit Semwal, John Stultz, Tomi Valkeinen,
Michal Simek, Hui Pu, Ian Ray, Thomas Petazzoni, dri-devel,
linux-kernel, linux-arm-msm, freedreno, linux-arm-kernel
On Mon, May 11, 2026 at 06:40:07PM +0200, Luca Ceresoli wrote:
> This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
> @panel parameter, thus using a reduced feature set of that function.
> Replace this call with the simpler of_drm_get_bridge_by_endpoint().
>
> Since of_drm_get_bridge_by_endpoint() increases the refcount of the
> returned bridge, ensure it is put on removal.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> ---
>
> Changes in v6:
> - move assignment of next_bridge earlier (avoid access before assignment)
>
> Changes in v5:
> - simplify error management code flow
>
> Changes in v4:
> - ensure next_bridge is put on later probe failures
>
> Changes in v3:
> - fix ERR_PTR deref when -ENODEV is returned
>
> - move assignment of next_bridge earlier (avoid access before assignment)
> ---
> drivers/gpu/drm/msm/hdmi/hdmi.c | 70 +++++++++++++++++++++++++++--------------
> 1 file changed, 47 insertions(+), 23 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Ack to merge this through the drm-misc tree
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge()
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
` (10 preceding siblings ...)
2026-05-11 16:40 ` [PATCH v6 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge() Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
11 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge()
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
Patches: 13
Reviewed: 2026-05-16T15:02:22.126708
---
This is a well-structured, incremental series that continues Luca Ceresoli's long-running work to add proper refcounting to DRM bridges. The series introduces `of_drm_get_bridge_by_endpoint()` as a refcount-aware replacement for bridge-only calls to the deprecated `drm_of_find_panel_or_bridge()`, converts all bridge-only callers, and then forbids that usage pattern going forward.
The approach is sound: the new API is simpler (returns the bridge directly instead of via double-pointer), safer (refcounted), and each driver conversion correctly handles the lifecycle of the returned bridge — either via the auto-put `bridge.next_bridge` field, explicit `drm_bridge_put()`, or the `__free(drm_bridge_put)` cleanup annotation.
All patches are already reviewed/acked except patches 3 and 4. The series is at v6, with the main changes across versions being error handling improvements. The code quality is high and the pattern is consistent.
**No blocking issues found.** A couple of very minor nits below.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: drm_bridge_put(): ignore ERR_PTR
2026-05-11 16:40 ` [PATCH v6 01/11] drm/bridge: drm_bridge_put(): ignore ERR_PTR Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Clean one-liner. The change from `if (bridge)` to `if (!IS_ERR_OR_NULL(bridge))` follows the standard kernel pattern (e.g. `kfree()` ignoring NULL). This is essential prep work since `of_drm_get_bridge_by_endpoint()` returns ERR_PTR values, and callers should be able to safely call `drm_bridge_put()` without checking first.
Already has R-by from Dmitry and Laurent. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: add of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 02/11] drm/bridge: add of_drm_get_bridge_by_endpoint() Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
The new function is a clean wrapper around `of_drm_find_and_get_bridge()` with OF graph resolution. Key details look correct:
```c
bridge = of_drm_find_and_get_bridge(remote);
if (!bridge)
return ERR_PTR(-EPROBE_DEFER);
```
This correctly converts the NULL return from `of_drm_find_and_get_bridge()` (bridge registered but not yet available) into `-EPROBE_DEFER`, matching the semantics of the old `drm_of_find_panel_or_bridge()`.
The non-OF inline stub correctly returns `ERR_PTR(-ENODEV)` rather than NULL, consistent with the new API contract.
**Very minor nit:** The kdoc return description is missing a trailing period:
```
* Returns a pointer to the connected drm_bridge, or a negative error on failure
```
Already has R-by from Dmitry and Laurent. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
2026-05-13 13:24 ` Dmitry Baryshkov
@ 2026-05-16 5:02 ` Claude Code Review Bot
1 sibling, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
This is the most involved conversion because the MSM HDMI driver's bridge is in a separate `hdmi_bridge` struct (allocated in `hdmi_bridge.c`), not embedded in the `hdmi` struct. So unlike later patches, this one can't use the auto-put `bridge.next_bridge` field and must manage the refcount explicitly.
The conversion correctly:
- Handles the `-ENODEV` case by setting `hdmi->next_bridge = NULL` (preserving old behavior)
- Changes all early-return paths after the bridge lookup to `goto err_put_bridge`
- Adds `drm_bridge_put(hdmi->next_bridge)` in both `err_put_bridge` and `msm_hdmi_dev_remove()`
The `drm_bridge_put()` in the remove function is safe even if `next_bridge` is NULL (patch 1 ensures this).
**Minor nit:** There's a double blank line introduced at the `devm_clk_bulk_get` error path:
```c
if (ret)
- return ret;
+ goto err_put_bridge;
+
hdmi->extp_clk = devm_clk_get_optional(dev, "extp");
```
No functional issues. This patch needs review/ack from MSM maintainers.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/hisilicon/kirin: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 04/11] drm/hisilicon/kirin: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Clever use of `__free(drm_bridge_put)` on the local bridge variable. The bridge is only needed to pass to `drm_bridge_attach()`, which (since v6.17) takes its own reference. So dropping the `of_drm_get_bridge_by_endpoint()` reference via the cleanup annotation when the variable goes out of scope is correct.
```c
struct drm_bridge *bridge __free(drm_bridge_put) = NULL;
```
This is the cleanest conversion pattern for drivers that don't store the next_bridge pointer. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: chrontel-ch7033: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 05/11] drm/bridge: chrontel-ch7033: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Good conversion. Removes the separate `next_bridge` field and migrates to `bridge.next_bridge`, which is auto-put when the bridge is freed (verified in the kernel tree — `__drm_bridge_free()` calls `drm_bridge_put(bridge->next_bridge)`). All references consistently updated:
```c
- return drm_bridge_detect(priv->next_bridge, connector);
+ return drm_bridge_detect(priv->bridge.next_bridge, connector);
```
No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: lontium-lt9611uxc: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 06/11] drm/bridge: lontium-lt9611uxc: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Same pattern as patch 5 — removes `next_bridge` field, uses `bridge.next_bridge`. Clean and correct. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: lt9611: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 07/11] drm/bridge: lt9611: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Same pattern as patches 5-6. Clean and correct. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: adv7511: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 08/11] drm/bridge: adv7511: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Same migration pattern. Also correctly handles the optional `-ENODEV` case (no downstream bridge connected):
```c
if (IS_ERR(adv7511->bridge.next_bridge)) {
if (PTR_ERR(adv7511->bridge.next_bridge) == -ENODEV)
adv7511->bridge.next_bridge = NULL;
else
return PTR_ERR(adv7511->bridge.next_bridge);
}
```
The existing `if (adv->bridge.next_bridge)` guard in `adv7511_bridge_attach()` correctly handles the NULL case. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm/bridge: lt8713sx: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 09/11] drm/bridge: lt8713sx: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Same pattern as patches 5-7 (no optional bridge, so no -ENODEV handling needed). Clean and correct. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm: zynqmp_dp: switch to of_drm_get_bridge_by_endpoint()
2026-05-11 16:40 ` [PATCH v6 10/11] drm: zynqmp_dp: " Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Same migration pattern with -ENODEV handling (the comment explains backward-compatibility with older DTs that don't have port@5). Removes the `next_bridge` field and the associated kdoc entry. The existing `if (dp->bridge.next_bridge)` guard in `zynqmp_dp_bridge_attach()` handles the NULL case. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
* Claude review: drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge()
2026-05-11 16:40 ` [PATCH v6 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge() Luca Ceresoli
@ 2026-05-16 5:02 ` Claude Code Review Bot
0 siblings, 0 replies; 26+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 5:02 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
Good final cleanup. The `WARN_ON(!panel)` serves as both a runtime check and documentation that bridge-only callers must use `of_drm_get_bridge_by_endpoint()` instead:
```c
- if (!panel && !bridge)
+ if (WARN_ON(!panel))
return -EINVAL;
```
The code simplification that follows (removing `if (panel)` guards) is a clean consequence. The function still correctly handles the `bridge == NULL` case for panel-only callers, and the `panel != NULL, bridge != NULL` case for dual-use callers.
The updated kdoc correctly points developers to the right replacement APIs. No issues.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2026-05-16 5:02 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 16:40 [PATCH v6 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-11 16:40 ` [PATCH v6 01/11] drm/bridge: drm_bridge_put(): ignore ERR_PTR Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 02/11] drm/bridge: add of_drm_get_bridge_by_endpoint() Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
2026-05-13 13:24 ` Dmitry Baryshkov
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 04/11] drm/hisilicon/kirin: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 05/11] drm/bridge: chrontel-ch7033: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 06/11] drm/bridge: lontium-lt9611uxc: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 07/11] drm/bridge: lt9611: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 08/11] drm/bridge: adv7511: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 09/11] drm/bridge: lt8713sx: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 10/11] drm: zynqmp_dp: " Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-11 16:40 ` [PATCH v6 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-16 5:02 ` Claude review: " Claude Code Review Bot
2026-05-16 5:02 ` Claude review: drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 10:45 [PATCH v4 00/11] " Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 05/11] drm/bridge: chrontel-ch7033: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
2026-05-04 22:26 ` Claude review: " Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox