]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpu: nova-core: vbios: use let-else in Vbios::new
authorEliot Courtney <ecourtney@nvidia.com>
Mon, 25 May 2026 13:57:35 +0000 (22:57 +0900)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 25 May 2026 18:18:08 +0000 (20:18 +0200)
Improve readability by moving the success path outside of a nested
branch.

Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://patch.msgid.link/20260525-fix-vbios-v5-17-e5e455251537@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/nova-core/vbios.rs

index 5266e15793cf53320372977f49c0678c94eaf045..52e33fdd4f5d6fa5496542cbd639abb5fda8fa23 100644 (file)
@@ -352,18 +352,18 @@ impl Vbios {
         }
 
         // Using all the images, setup the falcon data pointer in Fwsec.
-        if let (Some(pci_at), Some(fwsec_section)) = (pci_at_image, fwsec_section) {
-            let fwsec_image = FwSecBiosImage::new(dev, pci_at, fwsec_section)
-                .inspect_err(|e| dev_err!(dev, "Falcon data setup failed: {:?}\n", e))?;
-
-            Ok(Vbios { fwsec_image })
-        } else {
+        let (Some(pci_at), Some(fwsec_section)) = (pci_at_image, fwsec_section) else {
             dev_err!(
                 dev,
                 "Missing required images for falcon data setup, skipping\n"
             );
-            Err(EINVAL)
-        }
+            return Err(EINVAL);
+        };
+
+        let fwsec_image = FwSecBiosImage::new(dev, pci_at, fwsec_section)
+            .inspect_err(|e| dev_err!(dev, "Falcon data setup failed: {:?}\n", e))?;
+
+        Ok(Vbios { fwsec_image })
     }
 
     pub(crate) fn fwsec_image(&self) -> &FwSecBiosImage {