mirror-linux/drivers/gpu/drm/display
Luca Ceresoli 2be300f9a0 drm/display: bridge_connector: get/put the stored bridges
drm_bridge_connector_init() takes eight pointers to various bridges, some
of which can be identical, and stores them in pointers inside struct
drm_bridge_connector. Get a reference to each of the taken bridges and put
it on cleanup.

This is tricky because the pointers are currently stored directly in the
drm_bridge_connector in the loop, but there is no nice and clean way to put
those pointers on error return paths. To overcome this, store all pointers
in temporary local variables with a cleanup action, and only on success
copy them into struct drm_bridge_connector (getting another ref while
copying).

Additionally four of these pointers (edid, hpd, detect and modes) can be
written in multiple loop iterations, in order to eventually store the last
matching bridge. However, when one of those pointers is overwritten, we
need to put the reference that we got during the previous assignment. Add a
drm_bridge_put() before writing them to handle this.

Finally, there is also a function-local panel_bridge pointer taken inside
the loop and used after the loop. Use a cleanup action as well to ensure it
is put on return.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250926-drm-bridge-alloc-getput-bridge-connector-v2-1-138b4bb70576@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
2025-10-03 08:48:43 +02:00
..
Kconfig drm/display: bridge-connector: handle CEC adapters 2025-05-21 01:35:21 +03:00
Makefile drm/display: add CEC helpers code 2025-05-21 01:35:16 +03:00
drm_bridge_connector.c drm/display: bridge_connector: get/put the stored bridges 2025-10-03 08:48:43 +02:00
drm_display_helper_mod.c
drm_dp_aux_bus.c drm for 6.17-rc1 2025-07-30 19:26:49 -07:00
drm_dp_aux_dev.c
drm_dp_cec.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00
drm_dp_dual_mode_helper.c drm/i915/lspcon: do not hardcode settle timeout 2025-01-27 14:54:46 -05:00
drm_dp_helper.c drm/dp: clamp PWM bit count to advertised MIN and MAX capabilities 2025-10-01 09:19:22 +02:00
drm_dp_helper_internal.h
drm_dp_mst_topology.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00
drm_dp_mst_topology_internal.h
drm_dp_tunnel.c drm for 6.17-rc1 2025-07-30 19:26:49 -07:00
drm_dsc_helper.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00
drm_hdcp_helper.c
drm_hdmi_audio_helper.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00
drm_hdmi_cec_helper.c drm/display: hdmi-cec-helper: Fix adapter unregistration 2025-07-05 16:18:54 +03:00
drm_hdmi_cec_notifier_helper.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00
drm_hdmi_helper.c drm/connector: move HDR sink metadata to display info 2025-06-23 21:44:55 +03:00
drm_hdmi_state_helper.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00
drm_scdc_helper.c drm/display: Include <linux/export.h> 2025-06-16 09:02:32 +02:00