Re: [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs

Richard Fitzgerald <[email protected]>
Newsgroups org.kernel.vger.kernel-janitors,org.kernel.vger.linux-sound
Message-ID <[email protected]>
On 23/04/2026 11:09 am, Richard Fitzgerald wrote:
> On 23/04/2026 8:09 am, Dan Carpenter wrote:
>> The cs_amp_devm_get_vendor_specific_variant_id() function doesn't return
>> NULL, it returns error pointers.  Update the checking to match.
>>
>> Fixes: d70fa6b569a9 ("ASoC: cs-amp-lib-test: Tests for reading SSIDExV2")
>> Signed-off-by: Dan Carpenter <[email protected]>
>> ---
>>   sound/soc/codecs/cs-amp-lib-test.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/sound/soc/codecs/cs-amp-lib-test.c b/sound/soc/codecs/cs- 
>> amp-lib-test.c
>> index 636d0f3198b8..bb0cfd9d5db2 100644
>> --- a/sound/soc/codecs/cs-amp-lib-test.c
>> +++ b/sound/soc/codecs/cs-amp-lib-test.c
>> @@ -2360,7 +2360,7 @@ static void 
>> cs_amp_lib_test_ssidexv2_fetch_invalid(struct kunit *test)
>>                      cs_amp_lib_test_get_efi_vendor_sysid);
>>       got = cs_amp_devm_get_vendor_specific_variant_id(dev, 
>> PCI_VENDOR_ID_DELL, 0xabcd);
>> -    KUNIT_EXPECT_NOT_NULL(test, got);
>> +    KUNIT_EXPECT_NOT_ERR_OR_NULL(test, got);
>>       KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT);
>>   }
> 
> No, this is incorrect because we are expecting to get -ENOENT but now it
> will fail the KUNIT_EXPECT_NOT_ERR_OR_NULL() and not proceed to the next
> line where we assert that we got the expected error.
> 

Slight correction. It will proceed to the next line because it's an
EXPECT not an ASSERT. But it had a false fail from the
KUNIT_EXPECT_NOT_ERR_OR_NULL().

> The asserts are:
> 1. It should never return NULL (because it returns ERR_PTRs)
> 2. It should return ERR_PTR(-ENOENT)
> 
> The same for the cases below.
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.