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/drm_ras: Add clear-error-counter netlink command to drm_ras
Date: Sun, 12 Apr 2026 11:34:40 +1000	[thread overview]
Message-ID: <review-patch1-20260409073318.2909379-5-riana.tauro@intel.com> (raw)
In-Reply-To: <20260409073318.2909379-5-riana.tauro@intel.com>

Patch Review

**Overall**: Solid implementation that mirrors the existing `get-error-counter` doit pattern. The YAML anchor usage to avoid duplicating the attribute list is a nice touch.

**Error code for missing callback**: In `drm_ras_nl_clear_error_counter_doit()`:

```c
	node = xa_load(&drm_ras_xa, node_id);
	if (!node || !node->clear_error_counter)
		return -ENOENT;
```

When the node exists but the driver hasn't implemented `clear_error_counter`, returning `-ENOENT` is misleading — the node *was* found. Consider returning `-EOPNOTSUPP` (or `-ENOTSUPP`) for the missing-callback case, and `-ENOENT` only for the node-not-found case. This would give userspace a meaningful distinction:

```c
	node = xa_load(&drm_ras_xa, node_id);
	if (!node)
		return -ENOENT;
	if (!node->clear_error_counter)
		return -EOPNOTSUPP;
```

This is consistent with how other kernel subsystems signal "operation not supported by this driver." The existing `get_node_error_counter()` has the same conflation of the two cases (`!node || !node->query_error_counter`), but since `query_error_counter` is effectively mandatory for any registered node, it's less of a practical issue there. For `clear_error_counter`, which is explicitly optional, the distinction matters more.

**Pre-existing leak in `doit_reply_value()`** (not introduced by this patch, just noting): At line ~202-205 of the existing code, if `get_node_error_counter()` fails, `msg` is leaked:

```c
	msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
	...
	ret = get_node_error_counter(node_id, error_id, &error_name, &value);
	if (ret)
		return ret;  /* msg leaked */
```

Not blocking for this series, but worth a separate fix.

**Everything else looks correct**:
- The YAML spec properly uses an anchor `&id-attrs` on the `get-error-counter` request attributes and references it with `*id-attrs` in `clear-error-counter`. Clean.
- The NLA policy correctly requires both `NODE_ID` and `ERROR_ID` as `NLA_U32`.
- The genl_split_ops entry correctly uses `GENL_ADMIN_PERM | GENL_CMD_CAP_DO` — admin-only, doit-only (no dump), which is appropriate for a destructive/write operation.
- The `clear_error_counter` callback in `struct drm_ras_node` is well-documented and has the right signature.
- The range check mirrors `get_node_error_counter()` exactly, which is good.

---

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-04-12  1:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  7:33 [PATCH v2 0/2] Add clear-error-counter command to drm_ras Riana Tauro
2026-04-09  7:33 ` [PATCH v2 1/2] drm/drm_ras: Add clear-error-counter netlink " Riana Tauro
2026-04-09  7:21   ` Tauro, Riana
2026-04-09 13:37     ` Rodrigo Vivi
2026-04-10  5:21       ` Tauro, Riana
2026-04-09 23:01     ` Zack McKevitt
2026-04-10  5:25       ` Tauro, Riana
2026-04-12  1:34   ` Claude Code Review Bot [this message]
2026-04-09  7:33 ` [PATCH v2 2/2] drm/xe/xe_drm_ras: Add support for clear-error-counter in XE drm_ras Riana Tauro
2026-04-12  1:34   ` Claude review: " Claude Code Review Bot
2026-04-12  1:34 ` Claude review: Add clear-error-counter command to drm_ras Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-11 10:29 [PATCH 0/4] Add support for clear counter and error event in DRM RAS Riana Tauro
2026-03-11 10:29 ` [PATCH 1/4] drm/drm_ras: Add clear-error-counter netlink command to drm_ras Riana Tauro
2026-03-11 21:06   ` 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-patch1-20260409073318.2909379-5-riana.tauro@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