Re: [PATCH 70/70] drm/crtc: Remove reset
| Newsgroups | org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The return value of the newly introduced `atomic_create_state` hook is ignored in `amdgpu_dm_crtc_init()`, causing a memory leak and leaving the CRTC state uninitialized. -- --- Patch [70]: [PATCH 70/70] drm/crtc: Remove reset --- commit de86d4e5c49ea36efff6debb8f1603e3e3c819b9 Author: Maxime Ripard <[email protected]> drm/crtc: Remove reset All crtc drivers now implement the atomic_create_state hook instead of the reset hook for initial state creation. The reset hook conflated initial state allocation at probe time with hardware and software reset during suspend/resume, making error handling difficult since it is not fallible. Remove the reset hook from struct drm_crtc_funcs and the associated call in drm_mode_config_reset(). > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c > index 3bcc7bf0900c4..9f4eb694e1fb2 100644 > --- a/drivers/gpu/drm/drm_mode_config.c > +++ b/drivers/gpu/drm/drm_mode_config.c > @@ -296,9 +296,7 @@ void drm_mode_config_reset(struct drm_device *dev) > } > > drm_for_each_crtc(crtc, dev) { > - if (crtc->funcs->reset) > - crtc->funcs->reset(crtc); > - else if (crtc->funcs->atomic_create_state) > + if (crtc->funcs->atomic_create_state) > drm_mode_config_crtc_reset_with_create_state(crtc); > } [Severity: High] Does this transition leave the CRTC state uninitialized for AMD GPUs? An earlier patch in this series switched amdgpu_dm_crtc_init() to call atomic_create_state() instead of reset(), but the returned state pointer is now ignored: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c:amdgpu_dm_crtc_init() { ... /* Create the plane state */ if (acrtc->base.funcs->atomic_create_state) acrtc->base.funcs->atomic_create_state(&acrtc->base); ... } Since the returned struct drm_crtc_state pointer is not assigned to crtc->state, and the AMDGPU driver doesn't call drm_mode_config_reset() during probe, could this lead to a memory leak and a NULL pointer dereference when the DRM core later accesses the uninitialized CRTC state? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=70