]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/tilcdc: Convert to DRM managed resources
authorKory Maincent (TI.com) <kory.maincent@bootlin.com>
Fri, 23 Jan 2026 16:12:36 +0000 (17:12 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Wed, 11 Feb 2026 08:16:15 +0000 (09:16 +0100)
commit323401c9a166ea5faa300778f3ca336c01d8835a
treedc671f8d6b79a7a3b4c930a37e322c6686cba2d9
parent968fefee98d80bedbf1765e48201746880bf7277
drm/tilcdc: Convert to DRM managed resources

Convert the tilcdc driver to use DRM managed resources (drmm_* APIs)
to eliminate resource lifetime issues, particularly in probe deferral
scenarios.

This conversion addresses potential use-after-free bugs by ensuring
proper cleanup ordering through the DRM managed resource framework.
The changes include:
- Replace drm_crtc_init_with_planes() with drmm_crtc_alloc_with_planes()
- Replace drm_universal_plane_init() with drmm_universal_plane_alloc()
- Replace drm_simple_encoder_init() with drmm_simple_encoder_alloc()
- Remove manual cleanup in tilcdc_crtc_destroy() and error paths
- Remove drm_encoder_cleanup() from encoder error handling paths
- Use drmm_add_action_or_reset() for remaining cleanup operations

This approach is recommended by the DRM subsystem for improved resource
lifetime management and is particularly important for drivers that may
experience probe deferral.

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20260123-feature_tilcdc-v5-18-5a44d2aa3f6f@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
drivers/gpu/drm/tilcdc/tilcdc_drv.c
drivers/gpu/drm/tilcdc/tilcdc_drv.h
drivers/gpu/drm/tilcdc/tilcdc_encoder.c
drivers/gpu/drm/tilcdc/tilcdc_plane.c