Re: [PATCH 69/70] drm/atomic-helper: Remove __drm_atomic_helper_crtc_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: - [Medium] Memory leak and unassigned CRTC state due to ignored return value from `atomic_create_state`. -- --- Patch [69]: [PATCH 69/70] drm/atomic-helper: Remove __drm_atomic_helper_crtc_reset --- commit 9dc0ccd39531b9bf90d43caf9838f04ca43ed26d Author: Maxime Ripard <[email protected]> drm/atomic-helper: Remove __drm_atomic_helper_crtc_reset This patch series converts users of __drm_atomic_helper_crtc_reset() to use drm_atomic_helper_crtc_state_init() and atomic_create_state(). It then removes the now unused __drm_atomic_helper_crtc_reset() helper entirely. > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c > index d63688b9d93dd..e1cc74ba7a434 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c [ ... ] > @@ -757,9 +756,9 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, > > drm_crtc_helper_add(&acrtc->base, &amdgpu_dm_crtc_helper_funcs); > > - /* Create (reset) the plane state */ > - if (acrtc->base.funcs->reset) > - acrtc->base.funcs->reset(&acrtc->base); > + /* Create the plane state */ > + if (acrtc->base.funcs->atomic_create_state) > + acrtc->base.funcs->atomic_create_state(&acrtc->base); [Severity: Medium] Does this code leak the newly allocated state? The old .reset() hook called __drm_atomic_helper_crtc_reset(), which internally assigned crtc->state. The new .atomic_create_state() hook returns the allocated state pointer, but the return value is ignored here. Could this leave acrtc->base.state unassigned and leak the allocated struct dm_crtc_state during driver initialization? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=69