Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Leftover state destruction code in `atomic_create_state` callback violates API contract --
--- Patch [54]: [PATCH 54/60] drm/sun4i: layer: Convert to atomic_create_state --- commit 85f4174b6e45254800a7a99399fee4bf10972b0f Author: Maxime Ripard <[email protected]> drm/sun4i: layer: Convert to atomic_create_state This commit converts the plane reset implementation in sun4i to use atomic_create_state instead. The conversion relies on a Coccinelle semantic patch to rename the functions and update the DRM plane function assignments. > diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c > b/drivers/gpu/drm/sun4i/sun4i_layer.c > index d65587d96d9ee..b165960ca8e5d 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_layer.c > +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c > @@ -16,7 +16,7 @@ > #include "sun4i_layer.h" > #include "sunxi_engine.h" > > -static void sun4i_backend_layer_reset(struct drm_plane *plane) > +static struct drm_plane_state *sun4i_backend_layer_create_state(struct > drm_plane *plane) > { > struct sun4i_layer_state *state; > > @@ -30,8 +30,12 @@ static void sun4i_backend_layer_reset(struct drm_plane > *plane) > } [Severity: Medium] Does the Coccinelle script miss the plane state destruction block here? Looking at sun4i_backend_layer_create_state() in sun4i_layer.c, the untouched code right above this hunk still contains legacy state destruction logic: if (plane->state) { state = state_to_sun4i_layer_state(plane->state); __drm_atomic_helper_plane_destroy_state(&state->state); kfree(state); plane->state = NULL; } Since atomic_create_state is expected to be a pure constructor without side effects, shouldn't this block be removed? While plane->state is currently guaranteed to be NULL when this is called by the DRM core, retaining this block could lead to a use-after-free if any driver logic later calls this hook directly on an active plane. [ ... ] -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=54
