summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLuca Ceresoli <luca.ceresoli@bootlin.com>2025-07-08 18:48:19 +0300
committerLuca Ceresoli <luca.ceresoli@bootlin.com>2025-07-22 14:01:28 +0300
commit8fa5909400f377351836419223c33f1131f0f7d3 (patch)
treec1c20d77b68a5ce073c777fa2112ca887a1c064a /include
parent4d2d28776ae3ad7aa95328d28aff220b0ec6202d (diff)
downloadlinux-8fa5909400f377351836419223c33f1131f0f7d3.tar.xz
drm/bridge: get the bridge returned by drm_bridge_chain_get_first_bridge()
drm_bridge_chain_get_first_bridge() returns a bridge pointer that the caller could hold for a long time. Increment the refcount of the returned bridge and document it must be put by the caller. Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20250708-drm-bridge-alloc-getput-drm_bridge_chain_get_first_bridge-v9-2-db1ba3df7f58@bootlin.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_bridge.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 8290e665554e..717171d0e587 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -1337,6 +1337,9 @@ drm_bridge_get_prev_bridge(struct drm_bridge *bridge)
* drm_bridge_chain_get_first_bridge() - Get the first bridge in the chain
* @encoder: encoder object
*
+ * The refcount of the returned bridge is incremented. Use drm_bridge_put()
+ * when done with it.
+ *
* RETURNS:
* the first bridge in the chain, or NULL if @encoder has no bridge attached
* to it.
@@ -1344,8 +1347,8 @@ drm_bridge_get_prev_bridge(struct drm_bridge *bridge)
static inline struct drm_bridge *
drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder)
{
- return list_first_entry_or_null(&encoder->bridge_chain,
- struct drm_bridge, chain_node);
+ return drm_bridge_get(list_first_entry_or_null(&encoder->bridge_chain,
+ struct drm_bridge, chain_node));
}
/**