Re: [PATCH v4 3/8] gpu: nova-core: split BAR acquisition in unbind()

From: Eliot Courtney

Date: Tue Apr 28 2026 - 01:06:41 EST


On Mon Apr 27, 2026 at 3:57 PM JST, Alexandre Courbot wrote:
> We are going to use the BAR to perform other teardown tasks, so move its
> acquisition into a dedicated code block with a more meaningful error
> message.
>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> ---
> drivers/gpu/nova-core/gpu.rs | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index 233a4bcec9fc..920783362251 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs
> @@ -319,10 +319,11 @@ pub(crate) fn new<'a>(
> ///
> /// Note: This method must only be called from `Driver::unbind`.
> pub(crate) fn unbind(&self, dev: &device::Device<device::Core>) {
> - kernel::warn_on!(self
> - .bar
> - .access(dev)
> - .inspect(|bar| self.sysmem_flush.unregister(bar))
> - .is_err());
> + let Ok(bar) = self.bar.access(dev) else {
> + dev_err!(dev, "failed to acquire bar for driver unbinding\n");
> + return;
> + };
> +
> + self.sysmem_flush.unregister(bar);
> }
> }

I expect you saw but with the higher-rank lifetime changes from Danilo +
Gary we probably won't need this soon.

Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>