[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251101214629.10718-1-mt@markoturk.info>
Date: Sat, 1 Nov 2025 22:46:54 +0100
From: Marko Turk <mt@...koturk.info>
To: dakr@...nel.org, bhelgaas@...gle.com, kwilczynski@...nel.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
mt@...koturk.info
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Marko Turk <mt@...koturk.info>
Subject: [PATCH] samples: rust: fix endianness issue in rust_driver_pci
QEMU PCI test device specifies all registers as little endian. OFFSET
register is converted properly, but the COUNT register is not.
Apply the same conversion to the COUNT register also.
Signed-off-by: Marko Turk <mt@...koturk.info>
Fixes: 685376d18e9a ("samples: rust: add Rust PCI sample driver")
---
samples/rust/rust_driver_pci.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
index 55a683c39ed9..3cbb3139fbcf 100644
--- a/samples/rust/rust_driver_pci.rs
+++ b/samples/rust/rust_driver_pci.rs
@@ -56,7 +56,7 @@ fn testdev(index: &TestIndex, bar: &Bar0) -> Result<u32> {
// Note that we need `try_write8`, since `offset` can't be checked at compile-time.
bar.try_write8(data, offset)?;
- Ok(bar.read32(Regs::COUNT))
+ Ok(u32::from_le(bar.read32(Regs::COUNT)))
}
}
--
2.51.0
Powered by blists - more mailing lists