From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260531-nova-unload-fix-v1-1-c8dcdc769b53@nvidia.com> References: <20260531-nova-unload-fix-v1-1-c8dcdc769b53@nvidia.com> <20260531-nova-unload-fix-v1-1-c8dcdc769b53@nvidia.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 **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 partia= lly-unloaded state. **The fix has two parts:** 1. **FWSEC-SB error capture:** Instead of propagating immediately, the erro= r is captured and logged: ```rust let fwsec_sb_res =3D 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 =E2=80=94 it logs the error at the point of oc= currence while preserving the `Result` for later. 2. **Booter Unloader wrapped in a closure:** The WPR2 check and Booter Unlo= ader execution are wrapped in an immediately-invoked closure to capture its= result: ```rust let booter_unloader_res =3D (|| { 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 !w= pr2_hi.is_wpr2_set() { return Ok(()); }` =E2=80=94 this is a reasonable tra= nsformation to allow `?` usage inside the closure body while keeping the ea= rly-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 fi= rst `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 acceptabl= e 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 re= sult too, so that if both fail, the caller sees the FWSEC-SB error (via `an= d`) 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 =E2=80=94 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 `?` usa= ge in Rust without extracting a separate function. The commit message clear= ly 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