From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/amdgpu: Switch private_obj initialization to atomic_create_state Date: Fri, 27 Feb 2026 15:05:37 +1000 Message-ID: In-Reply-To: <20260224-drm-private-obj-reset-v5-1-5a72f8ec9934@kernel.org> References: <20260224-drm-private-obj-reset-v5-0-5a72f8ec9934@kernel.org> <20260224-drm-private-obj-reset-v5-1-5a72f8ec9934@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Commit message**: Clear and well-written. **Code review**: The new `dm_atomic_create_state()` function looks correct: ```c static struct drm_private_state * dm_atomic_create_state(struct drm_private_obj *obj) { struct amdgpu_device *adev =3D drm_to_adev(obj->dev); struct dm_atomic_state *dm_state; struct dc_state *context; dm_state =3D kzalloc_obj(*dm_state); if (!dm_state) return ERR_PTR(-ENOMEM); context =3D dc_state_create_current_copy(adev->dm.dc); if (!context) { kfree(dm_state); return ERR_PTR(-ENOMEM); } __drm_atomic_helper_private_obj_create_state(obj, &dm_state->base); dm_state->context =3D context; return &dm_state->base; } ``` This is well-structured with proper error cleanup if `dc_state_create_curre= nt_copy()` fails. **Issue: Missing return value check.** The call to `drm_atomic_private_obj_= init()` now passes `NULL` as the state, which means it will internally call= `atomic_create_state` =E2=80=94 which can fail (returning `ERR_PTR(-ENOMEM= )`). The return value is not checked: ```c drm_atomic_private_obj_init(adev_to_drm(adev), &adev->dm.atomic_obj, NULL, &dm_atomic_state_funcs); ``` This should be something like: ```c ret =3D drm_atomic_private_obj_init(adev_to_drm(adev), &adev->dm.atomic_obj, NULL, &dm_atomic_state_funcs); if (ret) return ret; ``` **Positive note**: The error path simplification is a nice side-effect. The= old code was arguably buggy =E2=80=94 it manually freed state on error aft= er `drm_atomic_private_obj_init()` had already registered the object, which= could lead to a use-after-free if cleanup later called `drm_atomic_private= _obj_fini()`. The new code avoids that class of bug. **Minor note (pre-existing)**: `dm_atomic_state_funcs` is not `const`, unli= ke the omap and tegra equivalents. Not introduced by this patch. --- --- Generated by Claude Code Patch Reviewer