From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amdgpu: switch XGMI sysfs show helpers to sysfs_emit_at()
Date: Sat, 14 Mar 2026 07:16:57 +1000 [thread overview]
Message-ID: <review-patch1-20260313015226.39727-1-davidbaum461@gmail.com> (raw)
In-Reply-To: <20260313015226.39727-1-davidbaum461@gmail.com>
Patch Review
**Positive aspects:**
1. Fixes a real (albeit likely benign in practice) undefined behavior issue where the old code passes `buf` as both output buffer and `%s` format argument in `sysfs_emit(buf, "%s\n", buf)`.
2. The conversion to `sysfs_emit_at()` is the correct modern kernel API for building up sysfs output incrementally.
3. Matches the existing style of `amdgpu_xgmi_show_connected_port_num()` at line 505 of the same file, which already uses `sysfs_emit_at()` with a `size` offset variable.
**Minor concern:**
The return value calculation on the final line:
```c
return offset + sysfs_emit_at(buf, offset, "\n");
```
This works correctly — `offset` holds the bytes written so far, and `sysfs_emit_at()` returns the number of bytes written for the newline (1), so the total returned is the full length. However, there is an edge case: if `sysfs_emit_at()` were to return a negative error value, this addition would produce an incorrect result. In practice, `sysfs_emit_at()` only returns negative if `offset` is already beyond `PAGE_SIZE`, which won't happen here with a reasonable `num_nodes` count. The neighboring `amdgpu_xgmi_show_connected_port_num()` uses the same `size +=` pattern, so this is consistent.
**Overall:** The patch is clean, correct, and well-scoped. No issues that would block merging.
Reviewed-by: looks good to me.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-03-13 21:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 1:52 [PATCH] drm/amdgpu: switch XGMI sysfs show helpers to sysfs_emit_at() David Baum
2026-03-13 14:04 ` Alex Deucher
2026-03-13 21:16 ` Claude review: " Claude Code Review Bot
2026-03-13 21:16 ` Claude Code Review Bot [this message]
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-20260313015226.39727-1-davidbaum461@gmail.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