public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: David Rhodes <david.rhodes@cirrus.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, patches@opensource.cirrus.com,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ASoC: cs-amp-lib-test: Fix some NULL vs IS_ERR() bugs
Date: Thu, 23 Apr 2026 14:26:30 +0300	[thread overview]
Message-ID: <aeoB5h-VPs1Oaebw@stanley.mountain> (raw)
In-Reply-To: <63c18e33-b2bc-492a-8879-3e298ca81465@opensource.cirrus.com>

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


      parent reply	other threads:[~2026-04-23 11:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeoB5h-VPs1Oaebw@stanley.mountain \
    --to=error27@gmail.com \
    --cc=broonie@kernel.org \
    --cc=david.rhodes@cirrus.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=rf@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox