From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: gpu: nova-core: gsp: tu102: keep unloading if FWSEC-SB fails
Date: Thu, 04 Jun 2026 14:51:00 +1000 [thread overview]
Message-ID: <review-patch1-20260531-nova-unload-fix-v1-1-c8dcdc769b53@nvidia.com> (raw)
In-Reply-To: <20260531-nova-unload-fix-v1-1-c8dcdc769b53@nvidia.com>
Patch Review
**The problem:** The original code early-returns on FWSEC-SB failure via `?`:
```rust
self.fwsec_sb.run(dev, bar, gsp_falcon)?;
```
This prevents the Booter Unloader from running, leaving the GSP in a partially-unloaded state.
**The fix has two parts:**
1. **FWSEC-SB error capture:** Instead of propagating immediately, the error is captured and logged:
```rust
let fwsec_sb_res = self
.fwsec_sb
.run(dev, bar, gsp_falcon)
.inspect_err(|e| dev_err!(dev, "FWSEC-SB failed to run: {:?}\n", e));
```
Using `inspect_err` is clean — it logs the error at the point of occurrence while preserving the `Result` for later.
2. **Booter Unloader wrapped in a closure:** The WPR2 check and Booter Unloader execution are wrapped in an immediately-invoked closure to capture its result:
```rust
let booter_unloader_res = (|| {
if !wpr2_hi.is_wpr2_set() {
return Ok(());
}
// ... falcon reset, load, run ...
Ok(())
})();
```
The closure inverts the condition from `if wpr2_hi.is_wpr2_set()` to `if !wpr2_hi.is_wpr2_set() { return Ok(()); }` — this is a reasonable transformation to allow `?` usage inside the closure body while keeping the early-exit-on-no-work semantic.
3. **Error combination:** Both results are combined with:
```rust
fwsec_sb_res.and(booter_unloader_res)
```
**One minor observation on error precedence:** `Result::and` returns the first `Err` it encounters (checking `self` first). So if *both* FWSEC-SB and Booter Unloader fail, only the FWSEC-SB error is propagated to the caller. The Booter Unloader error is silently discarded. This is probably acceptable since:
- The FWSEC-SB error is already logged via `inspect_err`
- But the Booter Unloader error is *not* logged before being dropped
It might be worth adding an `inspect_err` on the Booter Unloader closure result too, so that if both fail, the caller sees the FWSEC-SB error (via `and`) but the Booter Unloader failure is at least visible in dmesg. As-is, if both fail, the Booter Unloader error vanishes silently. However, this is a minor nit — the important fix (continuing despite FWSEC-SB failure) is correct.
**Reviewed-by assessment:** The patch is correct and addresses a real bug. The immediately-invoked closure pattern is a pragmatic way to scope `?` usage in Rust without extracting a separate function. The commit message clearly explains the rationale. This is good to go, with the optional suggestion to also log Booter Unloader failures for completeness.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 4:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-31 12:37 [PATCH] gpu: nova-core: gsp: tu102: keep unloading if FWSEC-SB fails Alexandre Courbot
2026-05-31 18:41 ` Timur Tabi
2026-06-01 1:44 ` Alexandre Courbot
2026-06-01 2:10 ` Eliot Courtney
2026-06-04 4:51 ` Claude Code Review Bot [this message]
2026-06-04 4:51 ` 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-20260531-nova-unload-fix-v1-1-c8dcdc769b53@nvidia.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