Use the warn_on_err macro in the unbind sequence, and refactor it to early-exit during the failure path as we will need to use the bar for other purposes.
Signed-off-by: Alexandre Courbot <[email protected]> --- drivers/gpu/nova-core/gpu.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 629c9d2dc994..e16d3c2a6b38 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -293,10 +293,10 @@ 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) = kernel::warn_on_err!(self.bar.access(dev)) else { + return; + }; + + self.sysmem_flush.unregister(bar); } } -- 2.52.0
