public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs
@ 2026-04-23  7:09 Dan Carpenter
  2026-04-23 10:09 ` Richard Fitzgerald
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2026-04-23  7:09 UTC (permalink / raw)
  To: Richard Fitzgerald
  Cc: David Rhodes, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-sound, patches, kernel-janitors

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 <error27@gmail.com>
---
 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);
 }
 
@@ -2376,7 +2376,7 @@ static void cs_amp_lib_test_ssidexv2_not_dell(struct kunit *test)
 
 	/* Not returned if SSID vendor is not Dell */
 	got = cs_amp_devm_get_vendor_specific_variant_id(dev, PCI_VENDOR_ID_CIRRUS, 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);
 }
 
@@ -2391,11 +2391,11 @@ static void cs_amp_lib_test_vendor_variant_id_not_found(struct kunit *test)
 				   cs_amp_lib_test_get_efi_variable_none);
 
 	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);
 
 	got = cs_amp_devm_get_vendor_specific_variant_id(dev, -1, -1);
-	KUNIT_EXPECT_NOT_NULL(test, got);
+	KUNIT_EXPECT_NOT_ERR_OR_NULL(test, got);
 	KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT);
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs
  2026-04-23  7:09 [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs Dan Carpenter
@ 2026-04-23 10:09 ` Richard Fitzgerald
  2026-04-23 10:24   ` Richard Fitzgerald
  2026-04-23 11:26   ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Fitzgerald @ 2026-04-23 10:09 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Rhodes, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-sound, patches, kernel-janitors

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 <error27@gmail.com>
> ---
>   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.

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.

>   
> @@ -2376,7 +2376,7 @@ static void cs_amp_lib_test_ssidexv2_not_dell(struct kunit *test)
>   
>   	/* Not returned if SSID vendor is not Dell */
>   	got = cs_amp_devm_get_vendor_specific_variant_id(dev, PCI_VENDOR_ID_CIRRUS, 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);
>   }
>   
> @@ -2391,11 +2391,11 @@ static void cs_amp_lib_test_vendor_variant_id_not_found(struct kunit *test)
>   				   cs_amp_lib_test_get_efi_variable_none);
>   
>   	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);
>   
>   	got = cs_amp_devm_get_vendor_specific_variant_id(dev, -1, -1);
> -	KUNIT_EXPECT_NOT_NULL(test, got);
> +	KUNIT_EXPECT_NOT_ERR_OR_NULL(test, got);
>   	KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT);
>   }
>   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs
  2026-04-23 10:09 ` Richard Fitzgerald
@ 2026-04-23 10:24   ` Richard Fitzgerald
  2026-04-23 11:26   ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Fitzgerald @ 2026-04-23 10:24 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Rhodes, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-sound, patches, kernel-janitors

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 <error27@gmail.com>
>> ---
>>   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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs
  2026-04-23 10:09 ` Richard Fitzgerald
  2026-04-23 10:24   ` Richard Fitzgerald
@ 2026-04-23 11:26   ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-04-23 11:26 UTC (permalink / raw)
  To: Richard Fitzgerald
  Cc: David Rhodes, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-sound, patches, kernel-janitors

On Thu, Apr 23, 2026 at 11:09:35AM +0100, 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 <error27@gmail.com>
> > ---
> >   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.
> 
> The asserts are:
> 1. It should never return NULL (because it returns ERR_PTRs)
> 2. It should return ERR_PTR(-ENOENT)
> 

Ah...  Ok.  Thanks.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-23 11:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23  7:09 [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs Dan Carpenter
2026-04-23 10:09 ` Richard Fitzgerald
2026-04-23 10:24   ` Richard Fitzgerald
2026-04-23 11:26   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox