Rust for Linux List
 help / color / mirror / Atom feed
From: Ivan Tverdokhleb <mbkchelofficialdev@gmail.com>
To: rust-for-linux@vger.kernel.org, nova-gpu@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org,
	"Ivan Tverdokhleb" <mbkchelofficialdev@gmail.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Onur Özkan" <work@onurozkan.dev>
Subject: [PATCH] gpu: nova-core: firmware: use ENODATA for empty TLV values
Date: Wed,  2 Dec 2026 10:53:52 +0200	[thread overview]
Message-ID: <20261202085352.74465-1-mbkchelofficialdev@gmail.com> (raw)

Tlv::get_bytes() returns EINVAL when a tag is present but its
value is empty, with a TODO to use ENODATA once available.

ENODATA is now defined in rust/kernel/error.rs, so return it instead
and update the doc comment accordingly.

Signed-off-by: Ivan Tverdokhleb <mbkchelofficialdev@gmail.com>
---
Based on next-20261118. Build-tested on x86_64 with CONFIG_RUST=y and
CONFIG_NOVA_CORE=y; not tested at runtime.

 drivers/gpu/nova-core/firmware/tlv.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/firmware/tlv.rs b/drivers/gpu/nova-core/firmware/tlv.rs
index 7b879f13a..cb58b1ede 100644
--- a/drivers/gpu/nova-core/firmware/tlv.rs
+++ b/drivers/gpu/nova-core/firmware/tlv.rs
@@ -200,13 +200,13 @@ fn iter(&self) -> TlvIter<'_, 'a> {
 
     /// Return a slice of bytes.
     ///
-    /// Returns `EINVAL` if the value is empty.
+    /// Returns `ENODATA` if the value is empty.
     pub(crate) fn get_bytes(&self, tag: &[u8; 4]) -> Result<&'a [u8]> {
         let tlv = self.find(tag)?;
 
         // Treat empty value as an error, to avoid trying to parse nothing.
         if tlv.value.is_empty() {
-            return Err(EINVAL); // TODO: Use ENODATA once available.
+            return Err(ENODATA);
         }
 
         Ok(tlv.value)
-- 
2.56.1


                 reply	other threads:[~2026-12-02  8:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202085352.74465-1-mbkchelofficialdev@gmail.com \
    --to=mbkchelofficialdev@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox