[PATCH] gpu: nova-core: switch NVKV dead_code attributes from expect to allow

From: Eliot Courtney

Date: Fri Dec 04 2026 - 02:19:09 EST


Once the r000 GSP_INIT command uses the NVKV encoder and decoder outside
of KUnit tests, rustc before 1.97.0 warns without `CONFIG_KUNIT=y` that
the `expect(dead_code)` at the top of encode.rs and decode.rs is
unfulfilled:

warning: this lint expectation is unfulfilled
--> drivers/gpu/nova-core/gsp/nvkv/encode.rs:4:45

warning: this lint expectation is unfulfilled
--> drivers/gpu/nova-core/gsp/nvkv/decode.rs:4:45

Switch both files from `expect(dead_code)` to `allow(dead_code)`. Once
GSP_INIT is merged, we can remove the attribute from encode.rs.

Reported-by: Timur Tabi <ttabi@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/1f88322ae5c6d879b293b2f2a96a36413dbafef3.camel@xxxxxxxxxx/
Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
This is a prerequisite for [1], which adds the GSP_INIT command and hits
build errors for rustc before 1.97.0.

This is based on drm-rust-next.

[1]: https://lore.kernel.org/all/20261203-b4-r000-switch-v1-0-b1463ec6dae2@xxxxxxxxxx/
---
drivers/gpu/nova-core/gsp/nvkv/decode.rs | 4 +++-
drivers/gpu/nova-core/gsp/nvkv/encode.rs | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/nvkv/decode.rs b/drivers/gpu/nova-core/gsp/nvkv/decode.rs
index 84c0c998b2c9..8445ac96c66c 100644
--- a/drivers/gpu/nova-core/gsp/nvkv/decode.rs
+++ b/drivers/gpu/nova-core/gsp/nvkv/decode.rs
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

-#![cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
+// TODO: expect() doesn't work here before rustc 1.97.0
+// https://github.com/rust-lang/rust/pull/154377
+#![cfg_attr(not(CONFIG_KUNIT = "y"), allow(dead_code))]

use core::marker::PhantomData;

diff --git a/drivers/gpu/nova-core/gsp/nvkv/encode.rs b/drivers/gpu/nova-core/gsp/nvkv/encode.rs
index c6891c0441ff..fa9e0421af79 100644
--- a/drivers/gpu/nova-core/gsp/nvkv/encode.rs
+++ b/drivers/gpu/nova-core/gsp/nvkv/encode.rs
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

-#![cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
+// TODO: expect() doesn't work here before rustc 1.97.0
+// https://github.com/rust-lang/rust/pull/154377
+#![cfg_attr(not(CONFIG_KUNIT = "y"), allow(dead_code))]

use kernel::prelude::*;
use zerocopy::Immutable;

---
base-commit: d9da44362d77bcbf1f5bfd2ba1c514e776fdb07c
change-id: 20261124-nvkv-build-fix-5d7bb239fff3

Best regards,
--
Eliot Courtney <ecourtney@xxxxxxxxxx>