From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/xe/drm_ras: Add per node cleanup action
Date: Sat, 16 May 2026 10:24:56 +1000 [thread overview]
Message-ID: <review-patch3-20260514202839.1888688-4-raag.jadav@intel.com> (raw)
In-Reply-To: <20260514202839.1888688-4-raag.jadav@intel.com>
Patch Review
**Verdict: Has a bug — double cleanup on `drmm_add_action_or_reset` failure.**
The overall refactoring from a single bulk cleanup action (`xe_drm_ras_unregister_nodes`) to per-node cleanup actions is a sound improvement. It guarantees that each successfully registered node is individually cleaned up during unwind, which solves the problem described.
However, this code has a bug:
```c
ret = drmm_add_action_or_reset(&xe->drm, cleanup_node, node);
if (ret) {
cleanup_node(&xe->drm, node);
return ret;
}
```
The `_or_reset` suffix in `drmm_add_action_or_reset` means the action is **already called on failure** (see `include/drm/drm_managed.h` line 38-39: *"upon failure @action is directly called for any cleanup work"*). Explicitly calling `cleanup_node()` again results in:
1. Double call to `drm_ras_node_unregister(node)` — the second call operates on an already-unregistered node
2. Double `kfree(node->device_name)` — harmless because the first call NULLs the pointer, but still wrong
The fix is simple — just `return ret`:
```c
ret = drmm_add_action_or_reset(&xe->drm, cleanup_node, node);
if (ret)
return ret;
```
**Commit message nit**: The commit message repeats the same description as patch 2 verbatim ("cleanup_node_param() is not registered in case of counter allocation failure, which results in stale memory of previous node..."). Since patch 2 already fixed the counter allocation issue, patch 3's description should focus on what it actually does: moving to per-node drmm cleanup actions for robust unwind and simplification.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 0:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 20:28 [PATCH v1 0/3] DRM RAS Fixes Raag Jadav
2026-05-14 20:28 ` [PATCH v1 1/3] drm/ras: Cancel and free message on get counter failure Raag Jadav
2026-05-16 0:24 ` Claude review: " Claude Code Review Bot
2026-05-14 20:28 ` [PATCH v1 2/3] drm/xe/drm_ras: Make counter allocation drm managed Raag Jadav
2026-05-16 0:24 ` Claude review: " Claude Code Review Bot
2026-05-14 20:28 ` [PATCH v1 3/3] drm/xe/drm_ras: Add per node cleanup action Raag Jadav
2026-05-16 0:24 ` Claude Code Review Bot [this message]
2026-05-16 0:24 ` Claude review: DRM RAS Fixes Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=review-patch3-20260514202839.1888688-4-raag.jadav@intel.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox