From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: rust: drm: gem/shmem: Add DmaResvGuard helper
Date: Wed, 27 May 2026 14:05:19 +1000 [thread overview]
Message-ID: <review-patch5-20260526212857.1158294-6-lyude@redhat.com> (raw)
In-Reply-To: <20260526212857.1158294-6-lyude@redhat.com>
Patch Review
**Status: Minor concerns**
The guard pattern is correct in structure:
```rust
+struct DmaResvGuard<'a, T: DriverObject>(&'a Object<T>);
+
+impl<'a, T: DriverObject> DmaResvGuard<'a, T> {
+ fn new(obj: &'a Object<T>) -> Self {
+ unsafe { bindings::dma_resv_lock(obj.raw_dma_resv(), ptr::null_mut()) };
+ Self(obj)
+ }
+}
```
**Concern 1**: `dma_resv_lock()` returns `int`, but the return value is silently discarded. With `ctx = NULL`, `ww_mutex_lock` reduces to a simple mutex lock that in practice always returns 0, but ignoring the return value is not ideal. Since this is called from `Drop` contexts (via `SGTableMap::drop` in patch 6) where returning errors isn't possible, at minimum a `WARN_ON` or `BUG_ON` on failure would be appropriate — or a comment explaining why the return is ignored.
**Concern 2**: The `#[expect(unused)]` attribute is removed in patch 6, which is correct for the series as a whole, but it means patch 5 in isolation adds dead code. This is a minor bisectability concern — consider squashing patches 5 and 6, or keeping `#[expect(unused)]` in patch 5 and removing it in patch 6.
The TODO comment about replacing with WwMutex is appropriate.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-27 4:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 21:28 [PATCH v14 0/6] rust: drm: gem: shmem: Add sg_table() function Lyude Paul
2026-05-26 21:28 ` [PATCH v14 1/6] rust: faux: Allow retrieving a bound Device Lyude Paul
2026-05-27 4:05 ` Claude review: " Claude Code Review Bot
2026-05-26 21:28 ` [PATCH v14 2/6] rust: gem: shmem: Fix Default implementation for ObjectConfig Lyude Paul
2026-05-27 4:05 ` Claude review: " Claude Code Review Bot
2026-05-26 21:28 ` [PATCH v14 3/6] rust: drm: gem: s/device::Device/Device/ for shmem.rs Lyude Paul
2026-05-27 4:05 ` Claude review: " Claude Code Review Bot
2026-05-26 21:28 ` [PATCH v14 4/6] drm/gem/shmem: Introduce __drm_gem_shmem_free_sgt_locked() Lyude Paul
2026-05-27 4:05 ` Claude review: " Claude Code Review Bot
2026-05-26 21:28 ` [PATCH v14 5/6] rust: drm: gem/shmem: Add DmaResvGuard helper Lyude Paul
2026-05-27 4:05 ` Claude Code Review Bot [this message]
2026-05-26 21:28 ` [PATCH v14 6/6] rust: drm: gem: Introduce shmem::Object::sg_table() Lyude Paul
2026-05-27 4:05 ` Claude review: " Claude Code Review Bot
2026-05-27 4:05 ` Claude review: rust: drm: gem: shmem: Add sg_table() function 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-patch5-20260526212857.1158294-6-lyude@redhat.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