[PATCH v2 1/3] gpu: nova-core: vbios: use from_le_bytes() for PCI ROM header parsing

From: John Hubbard

Date: Sat Apr 04 2026 - 17:30:57 EST


Clippy fires two clippy::precedence warnings on the manual
byte-shifting expression:
warning: operator precedence can trip the unwary
--> drivers/gpu/nova-core/vbios.rs:511:17
|
511 | / u32::from(data[29]) << 24
512 | | | u32::from(data[28]) << 16
513 | | | u32::from(data[27]) << 8
| |______________________________________________^

Clear the warnings by replacing manual byte-shifting with
u32::from_le_bytes(). Using from_le_bytes() is also a tiny code
improvement, because it uses less code and is clearer about the intent.

Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
---
drivers/gpu/nova-core/vbios.rs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 3e3fa5b72524..ebda28e596c5 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -507,12 +507,7 @@ fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {

if data.len() >= 30 {
// Read size_of_block at offset 0x1A.
- size_of_block = Some(
- u32::from(data[29]) << 24
- | u32::from(data[28]) << 16
- | u32::from(data[27]) << 8
- | u32::from(data[26]),
- );
+ size_of_block = Some(u32::from_le_bytes([data[26], data[27], data[28], data[29]]));
}

// For NBSI images, try to read the nbsiDataOffset at offset 0x16.
--
2.53.0