Re: [PATCH v5 15/22] gpu: nova-core: vbios: use the first PCI-AT image

From: Danilo Krummrich

Date: Mon May 25 2026 - 10:46:36 EST


On Mon May 25, 2026 at 3:57 PM CEST, Eliot Courtney wrote:
> @@ -333,7 +333,10 @@ pub(crate) fn new(dev: &device::Device, bar0: &Bar0) -> Result<Vbios> {
> // Convert to a specific image type
> match BiosImageType::try_from(image.pcir.code_type) {
> Ok(BiosImageType::PciAt) => {
> - pci_at_image = Some(PciAtBiosImage::try_from(image)?);
> + // Silently ignore any extra PCI-AT images.
> + if pci_at_image.is_none() {
> + pci_at_image = Some(PciAtBiosImage::try_from(image)?);
> + }
> }
> Ok(BiosImageType::FwSec) => {
> if first_fwsec_image.is_none() {

This does produce the following warning:

CLIPPY [M] drivers/gpu/nova-core/nova_core.o
warning: this `if` can be collapsed into the outer `match`
--> drivers/gpu/nova-core/vbios.rs:337:21
|
337 | / if pci_at_image.is_none() {
338 | | pci_at_image = Some(PciAtBiosImage::try_from(image)?);
339 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#collapsible_match
= note: `-W clippy::collapsible-match` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::collapsible_match)]`
help: collapse nested if block
|
335 ~ Ok(BiosImageType::PciAt)
336 | // Silently ignore any extra PCI-AT images.
337 ~ if pci_at_image.is_none() => {
338 | pci_at_image = Some(PciAtBiosImage::try_from(image)?);
339 ~ }
|

warning: 1 warning emitted

I can fix it up this way:

diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 82811e42e858..bf61b085d7c0 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -332,11 +332,10 @@ pub(crate) fn new(dev: &device::Device, bar0: &Bar0) -> Result<Vbios> {

// Convert to a specific image type
match BiosImageType::try_from(image.pcir.code_type) {
- Ok(BiosImageType::PciAt) => {
+ Ok(BiosImageType::PciAt)
// Silently ignore any extra PCI-AT images.
- if pci_at_image.is_none() {
+ if pci_at_image.is_none() => {
pci_at_image = Some(PciAtBiosImage::try_from(image)?);
- }
}
Ok(BiosImageType::FwSec) => {
if first_fwsec_image.is_none() {

However, I'm not exactly sure it really is an improvement in terms of
readability and whether this is a prime example for this lint.