[PATCH] gpu: nova-core: fix three clippy::precedence warnings
From: John Hubbard
Date: Fri Apr 03 2026 - 22:58:34 EST
Clippy warns when shifts and bitwise-OR are mixed without parentheses,
because the relative precedence of << and | is easy to misread. This was
causing 3 warnings in drm-rust-next.
For read_sysmem_flush_page_ga100(), add explicit parentheses.
For the PCI ROM header parsing, replace the manual byte-shifting with
u32::from_le_bytes(), which both fixes the warning and is clearer about
the intended byte order.
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
---
drivers/gpu/nova-core/fb/hal/ga100.rs | 7 ++++---
drivers/gpu/nova-core/vbios.rs | 7 +------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/nova-core/fb/hal/ga100.rs b/drivers/gpu/nova-core/fb/hal/ga100.rs
index 1c03783cddef..b5d0f04198f0 100644
--- a/drivers/gpu/nova-core/fb/hal/ga100.rs
+++ b/drivers/gpu/nova-core/fb/hal/ga100.rs
@@ -17,9 +17,10 @@
struct Ga100;
pub(super) fn read_sysmem_flush_page_ga100(bar: &Bar0) -> u64 {
- u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR).adr_39_08()) << FLUSH_SYSMEM_ADDR_SHIFT
- | u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI).adr_63_40())
- << FLUSH_SYSMEM_ADDR_SHIFT_HI
+ (u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR).adr_39_08())
+ << FLUSH_SYSMEM_ADDR_SHIFT)
+ | (u64::from(bar.read(regs::NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI).adr_63_40())
+ << FLUSH_SYSMEM_ADDR_SHIFT_HI)
}
pub(super) fn write_sysmem_flush_page_ga100(bar: &Bar0, addr: u64) {
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.
base-commit: 7c50d748b4a635bc39802ea3f6b120e66b1b9067
--
2.53.0