public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dan Carpenter <[email protected]>
To: [email protected], Daniel Baluta <[email protected]>
Cc: [email protected], [email protected],
	GNU/Weeb Mailing List <[email protected]>,
	[email protected], Mark Brown <[email protected]>
Subject: [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)
Date: Fri, 11 Mar 2022 21:59:17 +0300	[thread overview]
Message-ID: <[email protected]> (raw)

tree:   https://github.com/ammarfaizi2/linux-block broonie/sound/for-5.18
head:   6b6bb5e26222021abe1c5360f43b4c2ff1dd012f
commit: 6324cf901e14c6662be508f30485e0f09c54694d [33/171] ASoC: SOF: compr: Add compress ops implementation
config: microblaze-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220312/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48)

vim +/cstream +54 sound/soc/sof/compress.c

858f7a5c45cacb Daniel Baluta 2021-10-04  46  void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream)
858f7a5c45cacb Daniel Baluta 2021-10-04  47  {
6324cf901e14c6 Daniel Baluta 2022-01-20 @48  	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
                                                                                  ^^^^^^^^^^^^^^^^^^^^^^
6324cf901e14c6 Daniel Baluta 2022-01-20  49  	struct snd_compr_runtime *crtd = cstream->runtime;
                                                                                 ^^^^^^^^^^^^^^^^^
Dereference

858f7a5c45cacb Daniel Baluta 2021-10-04  50  	struct snd_soc_component *component;
6324cf901e14c6 Daniel Baluta 2022-01-20  51  	struct snd_compr_tstamp *tstamp;
858f7a5c45cacb Daniel Baluta 2021-10-04  52  	struct snd_sof_pcm *spcm;
858f7a5c45cacb Daniel Baluta 2021-10-04  53  
858f7a5c45cacb Daniel Baluta 2021-10-04 @54  	if (!cstream)
                                                    ^^^^^^^^
Checked too late

858f7a5c45cacb Daniel Baluta 2021-10-04  55  		return;
858f7a5c45cacb Daniel Baluta 2021-10-04  56  
6324cf901e14c6 Daniel Baluta 2022-01-20  57  	tstamp = crtd->private_data;
858f7a5c45cacb Daniel Baluta 2021-10-04  58  	component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
858f7a5c45cacb Daniel Baluta 2021-10-04  59  
858f7a5c45cacb Daniel Baluta 2021-10-04  60  	spcm = snd_sof_find_spcm_dai(component, rtd);
858f7a5c45cacb Daniel Baluta 2021-10-04  61  	if (!spcm) {
858f7a5c45cacb Daniel Baluta 2021-10-04  62  		dev_err(component->dev,
858f7a5c45cacb Daniel Baluta 2021-10-04  63  			"fragment elapsed called for unknown stream!\n");
858f7a5c45cacb Daniel Baluta 2021-10-04  64  		return;
858f7a5c45cacb Daniel Baluta 2021-10-04  65  	}
858f7a5c45cacb Daniel Baluta 2021-10-04  66  
6324cf901e14c6 Daniel Baluta 2022-01-20  67  	sof_set_transferred_bytes(tstamp, spcm->stream[cstream->direction].posn.host_posn,
6324cf901e14c6 Daniel Baluta 2022-01-20  68  				  crtd->buffer_size);
6324cf901e14c6 Daniel Baluta 2022-01-20  69  
858f7a5c45cacb Daniel Baluta 2021-10-04  70  	/* use the same workqueue-based solution as for PCM, cf. snd_sof_pcm_elapsed */
858f7a5c45cacb Daniel Baluta 2021-10-04  71  	schedule_work(&spcm->stream[cstream->direction].period_elapsed_work);
858f7a5c45cacb Daniel Baluta 2021-10-04  72  }

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/[email protected]


             reply	other threads:[~2022-03-11 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 18:59 Dan Carpenter [this message]
2022-03-11 22:41 ` [ammarfaizi2-block:broonie/sound/for-5.18 33/171] sound/soc/sof/compress.c:54 snd_sof_compr_fragment_elapsed() warn: variable dereferenced before check 'cstream' (see line 48) Ammar Faizi

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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