[PATCH] rust: io: fix unused Flags::from_raw warning without CONFIG_PCI
From: Eliot Courtney
Date: Sun Oct 25 2026 - 23:55:33 EST
Currently, `Flags::from_raw()` is only used by
`pci::Device::resource_flags()`, so rustc errors (with CONFIG_WERROR)
saying that it is never used when `CONFIG_PCI` is disabled.
error: associated function `from_raw` is never used
--> rust/kernel/io/resource.rs:240:25
`Resource::flags()` also converts the raw `flags` field to `Flags` and is
built in every config, so the easiest way to get rid of this error is
to just use it there too.
Fixes: 3f1e12fce16f ("rust: pci: add resource_flags accessor")
Reported-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/20261023154005.95904-1-ojeda@xxxxxxxxxx/
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202610241133.L9VWoFcD-lkp@xxxxxxxxx/
Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
rust/kernel/io/resource.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/io/resource.rs b/rust/kernel/io/resource.rs
index 758ce62b3cce..29771355cfce 100644
--- a/rust/kernel/io/resource.rs
+++ b/rust/kernel/io/resource.rs
@@ -164,7 +164,7 @@ pub fn flags(&self) -> Flags {
// SAFETY: Safe as per the invariants of `Resource`.
let flags = unsafe { (*inner).flags };
- Flags(flags)
+ Flags::from_raw(flags)
}
}
---
base-commit: 21a7f44fd0765fcc5194130b28767786eba1d1e7
change-id: 20261026-pci-fix-5ac8d9f642c7
Best regards,
--
Eliot Courtney <ecourtney@xxxxxxxxxx>