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: Thu, 04 Jun 2026 13:22:00 +1000 [thread overview]
Message-ID: <review-patch3-20260602044919.702209-4-raag.jadav@intel.com> (raw)
In-Reply-To: <20260602044919.702209-4-raag.jadav@intel.com>
Patch Review
**Verdict: Correct, with one observation.**
This is the most substantial change. It replaces the monolithic `xe_drm_ras_unregister_nodes()` cleanup (registered once for all nodes) with per-node `drmm_add_action_or_reset()` calls, guaranteeing that each successfully-initialized node is cleaned up individually during unwind.
The error paths in `register_nodes()` are carefully structured:
```c
ret = drmm_add_action_or_reset(&xe->drm, cleanup_node, node);
if (ret)
goto null_info;
```
Jumping to `null_info` (not `free_param`) on `drmm_add_action_or_reset` failure is critical. Since the `_or_reset` variant calls `cleanup_node()` itself on failure (which frees `device_name` and unregisters the node), jumping to `free_param` would double-free `device_name`. The v3 changelog confirms this was caught by a reviewer — good catch.
**Observation:** After patch 3, `cleanup_node_param()` no longer NULLs out `ras->info[severity]`. During normal device teardown, the drmm actions run `cleanup_node()` → `cleanup_node_param()`, which frees `device_name` but leaves `ras->info[severity]` as a dangling pointer (the counter memory is freed separately by its own drmm tracking). This is safe because the xe_device is being torn down, but it's a departure from the defensive NULL-after-free pattern. Worth noting but not blocking — the init-time error path in `register_nodes()` does NULL it out via `null_info`, which is the path where it matters.
**Teardown ordering is correct:** drmm releases in reverse registration order, so per-node `cleanup_node` actions run before the node array itself is freed (`drmm_kcalloc` in `xe_drm_ras_init`), ensuring the nodes are still valid when `drm_ras_node_unregister` and `cleanup_node_param` access them.
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 3:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 4:48 [PATCH v3 0/4] DRM RAS Fixes Raag Jadav
2026-06-02 4:48 ` [PATCH v3 1/4] drm/ras: Cancel and free message on get counter failure Raag Jadav
2026-06-04 3:22 ` Claude review: " Claude Code Review Bot
2026-06-02 4:48 ` [PATCH v3 2/4] drm/xe/drm_ras: Make counter allocation drm managed Raag Jadav
2026-06-04 3:22 ` Claude review: " Claude Code Review Bot
2026-06-02 4:48 ` [PATCH v3 3/4] drm/xe/drm_ras: Add per node cleanup action Raag Jadav
2026-06-04 3:22 ` Claude Code Review Bot [this message]
2026-06-02 4:48 ` [PATCH v3 4/4] drm/xe/hw_error: Use HW_ERR prefix in log Raag Jadav
2026-06-04 3:22 ` Claude review: " Claude Code Review Bot
2026-06-04 3:21 ` Claude review: DRM RAS Fixes Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-23 5:00 [PATCH v2 0/4] " Raag Jadav
2026-05-23 5:00 ` [PATCH v2 3/4] drm/xe/drm_ras: Add per node cleanup action Raag Jadav
2026-05-25 7:57 ` Claude review: " Claude Code Review Bot
2026-05-14 20:28 [PATCH v1 0/3] DRM RAS Fixes Raag Jadav
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 review: " 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-20260602044919.702209-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