public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
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: Mon, 25 May 2026 17:57:40 +1000	[thread overview]
Message-ID: <review-patch3-20260523050212.557292-4-raag.jadav@intel.com> (raw)
In-Reply-To: <20260523050212.557292-4-raag.jadav@intel.com>

Patch Review

**Verdict: Correct fix for a real leak, two minor observations.**

This is the most substantial patch. The old code registered a single `xe_drm_ras_unregister_nodes` action in `xe_drm_ras_init()` *after* `register_nodes()` succeeded. If `register_nodes()` failed partway through (e.g., node 0 succeeds but node 1 fails), previously registered nodes were never cleaned up because the batch cleanup action was never registered. The new design registers a `drmm_add_action_or_reset` per node immediately after successful registration, guaranteeing cleanup on unwind.

The error path after the loop is correct:

```c
if (ret) {
    cleanup_node_param(node);
    ras->info[i] = NULL;
}
```

This handles the current (failed) iteration's resources. Previously completed iterations are covered by their already-registered drmm actions.

**Minor observation 1:** If `drmm_add_action_or_reset()` fails, it calls `cleanup_node()` itself (the `_or_reset` semantics), which already runs `cleanup_node_param(node)`. The post-loop `cleanup_node_param(node)` is then a redundant second call. This is **safe** because `cleanup_node_param` sets `device_name = NULL` after freeing, so `kfree(NULL)` on the second call is a no-op. Just worth noting — not a bug.

**Minor observation 2:** `ret` is declared uninitialized:

```c
int i, ret;
```

If `DRM_XE_RAS_ERR_SEV_MAX` were ever 0, `ret` would be used uninitialized in `if (ret)`. In practice this can't happen (there are always correctable and uncorrectable severities), but initializing `ret = 0` would silence potential compiler warnings and be more defensive. Very minor.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-25  7:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23  5:00 [PATCH v2 0/4] DRM RAS Fixes Raag Jadav
2026-05-23  5:00 ` [PATCH v2 1/4] drm/ras: Cancel and free message on get counter failure Raag Jadav
2026-05-25  7:57   ` Claude review: " Claude Code Review Bot
2026-05-23  5:00 ` [PATCH v2 2/4] drm/xe/drm_ras: Make counter allocation drm managed Raag Jadav
2026-05-25  7:57   ` Claude review: " Claude Code Review Bot
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 Code Review Bot [this message]
2026-05-23  5:00 ` [PATCH v2 4/4] drm/xe/hw_error: Use HW_ERR prefix in log Raag Jadav
2026-05-25  7:57   ` Claude review: " Claude Code Review Bot
2026-05-25  7:57 ` Claude review: DRM RAS Fixes Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-14 20:28 [PATCH v1 0/3] " 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-20260523050212.557292-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