linux/drivers/gpu/drm/sti
Albert Esteve b71a623598 drm/panel: of_drm_find_panel() return a counted reference
Callers of of_drm_find_panel() and drm_of_find_panel_or_bridge()
receive a pointer with no reference held, creating a window where
the panel device can be unregistered and freed between the lookup
and first use (e.g., drm_panel_prepare()).

Fix the lookup function by acquiring a reference with drm_panel_get()
before returning, under panel_lock. Callers are now responsible for
calling drm_panel_put() when they no longer need the pointer.

For bridge drivers that immediately wrap the panel in a panel_bridge
(which acquires its own reference), release the lookup reference right
after the bridge creation call.

For analogix-anx6345, which stores the panel for direct use, release
the reference in the i2c remove path.

For platform drivers using analogix_dp_core with a component lifecycle
(exynos_dp, rockchip analogix_dp), release the lookup reference in the
platform remove() function. The panel_bridge created during bind() holds
a separate reference that devm cleanup releases after remove() returns.

Also fix devm_drm_of_get_bridge() and drmm_of_get_bridge() in
bridge/panel.c itself, update a second batch of drivers calling
of_drm_find_panel() or drm_of_find_panel_or_bridge() to release the
lookup reference after wrapping the panel in a bridge, and handle the
cases where a panel is found but cannot be used, dropping the reference
immediately in those paths.

Assisted-by: Claude:claude-opus-4-6
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20260717-drm_refcount_wiring-v3-3-023900c32e01@redhat.com
2026-07-20 15:07:22 +02:00
..
Kconfig drm/sti: Run DRM default client setup 2024-09-26 09:31:27 +02:00
Makefile drm/sti: remove duplicate object names 2025-04-03 18:24:24 +02:00
NOTES
sti_awg_utils.c
sti_awg_utils.h
sti_compositor.c drm/sti: move to devm_platform_ioremap_resource() usage 2025-03-10 16:25:26 -04:00
sti_compositor.h
sti_crtc.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
sti_crtc.h
sti_cursor.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
sti_cursor.h
sti_drv.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sti_drv.h
sti_dvo.c drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
sti_gdp.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
sti_gdp.h
sti_hda.c drm/sti: hda: Switch to atomic bridge callbacks 2026-07-15 09:46:15 +02:00
sti_hdmi_tx3g4c28phy.c drm/sti: hdmi: Use the common TMDS char rate constants 2026-05-21 11:45:52 +02:00
sti_hdmi_tx3g4c28phy.h
sti_hdmi.c drm/sti: hdmi: Switch to atomic bridge callbacks 2026-07-15 09:46:15 +02:00
sti_hdmi.h drm/sti: hdmi: convert to devm_drm_bridge_alloc() API 2025-07-09 11:24:45 +02:00
sti_hqvdp_lut.h
sti_hqvdp.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
sti_mixer.c drm/sti: Add __iomem for mixer_dbg_mxn's parameter 2024-11-26 14:02:25 +01:00
sti_mixer.h
sti_plane.c drm: include drm_print.h where needed 2025-10-31 10:34:52 +02:00
sti_plane.h drm: Remove unnecessary include statements of drm_plane_helper.h 2022-07-26 18:42:04 +02:00
sti_tvout.c drm/sti: move to devm_platform_ioremap_resource() usage 2025-03-10 16:25:26 -04:00
sti_vid.c
sti_vid.h
sti_vtg.c drm: sti: fix device leaks at component probe 2025-11-24 13:56:16 +01:00
sti_vtg.h