Skip to contentSkip to conversation

gpu: nova-core: firmware: use ENODATA for empty TLV values

PATCH New Ivan Tverdokhleb 1 participant 1 message Dec 2

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu: nova-core: firmware: use ENODATA for empty TLV values

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.

---
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(-)
drivers/gpu/nova-core/firmware/tlv.rs +2 -2
index 7b879f13a..cb58b1ede 100644
@@ -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)
Signature · 1 line
2.56.1