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 <[email protected]> --- 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
