Re: [PATCH v3 2/7] gpu: nova-core: add TLV parser for firmware files

"Alexandre Courbot" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Tue Jul 7, 2026 at 11:56 AM JST, Timur Tabi wrote:
> On Mon, 2026-07-06 at 15:31 +0900, Alexandre Courbot wrote:
>> > I forgot to update get_bytes() to return an error if the value is empty.  That should
>> > address a lot
>> > of potential issues, including the ones that Sashiko raised.
>> 
>> The spec says that
>> 
>>   Lengths of zero are allowed and indicate that the tag is a boolean.
>> 
>> though, so we probably don't want to return an error in that case.
>
> Just don't call get_bytes() if you expect it to have no value.  I can add a get_bool() or
> is_true() function to handle booleans, but there are no users.
>
> Returning error on length==0 simplifies a lot of code on the caller side.

Can you give an example of such a simplification? I'm fine if there is a
benefit to doing so, but would like to understand what we gain.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.