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: Fix init ordering in amdgpu_vram_mgr_init() Date: Sat, 16 May 2026 14:03:59 +1000 Message-ID: In-Reply-To: <20260512082406.44470-2-thomas.hellstrom@linux.intel.com> References: <20260512082406.44470-1-thomas.hellstrom@linux.intel.com> <20260512082406.44470-2-thomas.hellstrom@linux.intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Verdict: Good. Straightforward correctness fix.** The commit message clearly explains the crash: `drmm_cgroup_register_region()` was called before `INIT_LIST_HEAD()` and `gpu_buddy_init()`, so a registration failure left the lists zero-initialized (not empty) and the buddy allocator uninitialized, causing NULL dereferences in `amdgpu_vram_mgr_fini()`. The fix correctly moves the cgroup registration after the list and buddy allocator initialization: ```c + man->cg = drmm_cgroup_register_region(adev_to_drm(adev), "vram", adev->gmc.real_vram_size); + if (IS_ERR(man->cg)) + return PTR_ERR(man->cg); ``` Now placed after `gpu_buddy_init()` succeeds, so the teardown path can safely iterate the lists and call `gpu_buddy_fini()`. The Fixes/Cc-stable tags are appropriate. No issues. Note: Patch 5 replaces this exact code with the new `ttm_resource_manager_set_dmem_region()` helper, so patch 1 exists as a standalone backportable fix for stable kernels. This split is correct. --- --- Generated by Claude Code Patch Reviewer