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: unregister sysmem flush page from Drop Date: Wed, 27 May 2026 15:28:23 +1000 Message-ID: In-Reply-To: <20260525225838.276108-3-dakr@kernel.org> References: <20260525225838.276108-1-dakr@kernel.org> <20260525225838.276108-3-dakr@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review This patch stores `&'sys Bar0` in `SysmemFlush` and implements `Drop` to au= tomatically unregister the flush page, removing the manual `unregister()` c= all and `Gpu::unbind()` entirely. **Drop implementation:** ```rust impl Drop for SysmemFlush<'_> { fn drop(&mut self) { let hal =3D hal::fb_hal(self.chipset); if hal.read_sysmem_flush_page(self.bar) =3D=3D self.page.dma_handle= () { let _ =3D hal.write_sysmem_flush_page(self.bar, 0).inspect_err(= |e| { dev_warn!( &self.device, "failed to unregister sysmem flush page: {:?}\n", e ) }); ``` This is a good pattern =E2=80=94 the `Drop` impl reads the bar to verify th= e page is still the active flush page before clearing it. The error message= on the else-branch (unchanged from the old `unregister()`) is retained. **Note on `self.device` in Drop:** At this point in the series, `self.devic= e` is still `ARef`, which is fine =E2=80=94 the ARef keeps = the device alive. Patch 3 changes this to a borrowed `&'sys device::Device`= , which is also fine because the lifetime guarantee ensures the device outl= ives SysmemFlush. **Removal of `unbind`:** ```diff - fn unbind<'bound>(_pdev: &'bound pci::Device>, this: Pin<&Sel= f::Data<'bound>>) { - this.gpu.unbind(); - } ``` This is correct =E2=80=94 with Drop-based cleanup, the explicit unbind call= back is unnecessary. The struct drop order (gpu dropped before bar, as anal= yzed in patch 1) ensures the Drop runs while the bar is still valid. The `Fixes:` and `Reported-by:` tags are appropriate =E2=80=94 this address= es an existing bug where forgetting to call `unregister()` could leave a da= ngling flush page. No issues found. --- Generated by Claude Code Patch Reviewer