[PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation

Eliot Courtney
2026-04-01T01:42:51Z

The current implementation does not actually set the default values for
the fields in the bitfield.

Fixes: 3fa145bef533 ("gpu: nova-core: register: generate correct `Default` implementation")
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
It doesn't actually set the default values for each field. I know that
bitfields are being moved soon, so maybe this fix is unnecessary but I
saw it and it's a simple fix.
---
Changes in v2:
- add "Fixes"
- remove test
- Link to v1: https://patch.msgid.link/20260331-fix-bitfield-v1-1-ebe1a72b4fae@nvidia.com
---
drivers/gpu/nova-core/bitfield.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/nova-core/bitfield.rs b/drivers/gpu/nova-core/bitfield.rs
index 16e143658c51..02efdcf78d89 100644
--- a/drivers/gpu/nova-core/bitfield.rs
+++ b/drivers/gpu/nova-core/bitfield.rs
@@ -314,12 +314,11 @@ fn fmt(&self, f: &mut ::kernel::fmt::Formatter<'_>) -> ::kernel::fmt::Result {
/// Returns a value for the bitfield where all fields are set to their default value.
impl ::core::default::Default for $name {
fn default() -> Self {
- #[allow(unused_mut)]
- let mut value = Self(Default::default());
+ let value = Self(Default::default());

::kernel::macros::paste!(
$(
- value.[<set_ $field>](Default::default());
+ let value = value.[<set_ $field>](Default::default());
)*
);

---
base-commit: 7c50d748b4a635bc39802ea3f6b120e66b1b9067
change-id: 20260331-fix-bitfield-a03f6d1b9e00

Best regards,
--
Eliot Courtney <ecourtney@nvidia.com>