From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: dan.carpenter@oracle.com
Cc: kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org,
linux-mm@kvack.org, broonie@kernel.org,
Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: Re: [linux-next:master 9388/11353] sound/soc/soc-compress.c:628 snd_soc_new_compress() error: we previously assumed 'codec_dai' could be null (see line 571)
Date: Thu, 10 Mar 2022 09:38:30 +0800 [thread overview]
Message-ID: <20220310013830.1142718-1-jiasheng@iscas.ac.cn> (raw)
On Wed, Mar 09, 2022 at 18:18:23PM +0800, Dan Carpenter wrote:
> Yeah. That's true. Smatch tries to look at conditions and figure out
> the implications but this one is too complicated.
>
> But if codec_dai can really be NULL then it would be easier to
> understand if we reversed the check on codec_dai and returned early.
>
> if (!codec_dai) {
> dev_err(rtd->card->dev, "Missing codec\n");
> return -EINVAL;
> }
>
> /* check client and interface hw capabilities */
> if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&
> snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK))
> playback = 1;
Thanks, it looks good to me.
I will submit a patch with
"Reported-by: Dan Carpenter <dan.carpenter@oracle.com>"
to make the code more clear.
Jiang
next reply other threads:[~2022-03-10 1:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 1:38 Jiasheng Jiang [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-03-09 9:32 Jiasheng Jiang
2022-03-09 10:18 ` Dan Carpenter
2022-03-08 17:58 Dan Carpenter
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=20220310013830.1142718-1-jiasheng@iscas.ac.cn \
--to=jiasheng@iscas.ac.cn \
--cc=broonie@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.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