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/drm_ras: Add clear-error-counter netlink command to drm_ras Date: Sun, 12 Apr 2026 11:34:40 +1000 Message-ID: In-Reply-To: <20260409073318.2909379-5-riana.tauro@intel.com> References: <20260409073318.2909379-4-riana.tauro@intel.com> <20260409073318.2909379-5-riana.tauro@intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Overall**: Solid implementation that mirrors the existing `get-error-coun= ter` 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_doi= t()`: ```c node =3D 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 =E2=80=94 the node *was* found. Consid= er 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 =3D 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 s= upported by this driver." The existing `get_node_error_counter()` has the s= ame conflation of the two cases (`!node || !node->query_error_counter`), bu= t since `query_error_counter` is effectively mandatory for any registered n= ode, 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_c= ounter()` fails, `msg` is leaked: ```c msg =3D genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); ... ret =3D 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-count= er` request attributes and references it with `*id-attrs` in `clear-error-c= ounter`. Clean. - The NLA policy correctly requires both `NODE_ID` and `ERROR_ID` as `NLA_U= 32`. - The genl_split_ops entry correctly uses `GENL_ADMIN_PERM | GENL_CMD_CAP_D= O` =E2=80=94 admin-only, doit-only (no dump), which is appropriate for a de= structive/write operation. - The `clear_error_counter` callback in `struct drm_ras_node` is well-docum= ented and has the right signature. - The range check mirrors `get_node_error_counter()` exactly, which is good. --- --- Generated by Claude Code Patch Reviewer