linux/drivers/gpu/drm/tidss
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/tidss: Run DRM default client setup 2024-09-26 09:31:27 +02:00
Makefile drm/tidss: Add OLDI bridge support 2025-06-26 12:37:24 +03:00
tidss_crtc.c drm/tidss: Convert to atomic_create_state 2026-05-29 11:42:46 +02:00
tidss_crtc.h drm/tidss: Replace HTTP links with HTTPS ones 2020-07-16 22:13:52 +02:00
tidss_dispc_regs.h drm/tidss: dispc: Define field masks being used 2025-09-01 10:37:20 +03:00
tidss_dispc.c drm/tidss: Move OLDI mode validation to OLDI bridge mode_valid hook 2025-11-12 11:54:39 +02:00
tidss_dispc.h drm/tidss: Remove max_pclk_khz and min_pclk_khz from tidss display features 2025-11-12 11:52:40 +02:00
tidss_drv.c drm/tidss: Remove ftrace-like logs 2025-09-30 11:56:25 +02:00
tidss_drv.h drm/tidss: Move OLDI mode validation to OLDI bridge mode_valid hook 2025-11-12 11:54:39 +02:00
tidss_encoder.c drm/tidss: encoder: Switch to atomic_create_state 2026-06-22 11:24:54 +02:00
tidss_encoder.h drm/tidss: Update encoder/bridge chain connect model 2023-07-10 14:21:29 +02:00
tidss_irq.c drm/tidss: Rename 'wait_lock' to 'irq_lock' 2024-11-25 13:10:23 +02:00
tidss_irq.h drm/tidss: Remove unused OCP error flag 2024-11-25 13:10:20 +02:00
tidss_kms.c drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
tidss_kms.h drm/tidss: Replace HTTP links with HTTPS ones 2020-07-16 22:13:52 +02:00
tidss_oldi.c drm/tidss: oldi: Switch to atomic_create_state 2026-06-22 11:24:54 +02:00
tidss_oldi.h drm/tidss: Add OLDI bridge support 2025-06-26 12:37:24 +03:00
tidss_plane.c drm/tidss: Convert to atomic_create_state 2026-05-29 11:42:46 +02:00
tidss_plane.h drm/tidss: Fix missing includes and struct decls 2025-08-13 10:20:37 +03:00
tidss_scale_coefs.c drm/tidss: Replace HTTP links with HTTPS ones 2020-07-16 22:13:52 +02:00
tidss_scale_coefs.h drm/tidss: Fix missing includes and struct decls 2025-08-13 10:20:37 +03:00