From: Takashi Iwai <tiwai@suse.de>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: alsa-devel@alsa-project.org, Dan Carpenter <error27@gmail.com>
Subject: Re: [bug report] ALSA: hda: Interrupt servicing and BDL setup for compress streams
Date: Wed, 07 Dec 2022 17:55:08 +0100 [thread overview]
Message-ID: <875yen9ms3.wl-tiwai@suse.de> (raw)
In-Reply-To: <8868a1c7-8bfc-5576-09f6-52af96dd26ee@intel.com>
On Wed, 07 Dec 2022 15:35:12 +0100,
Cezary Rojewski wrote:
>
> On 2022-12-07 3:28 PM, Dan Carpenter wrote:
> > Hello Cezary Rojewski,
> >
> > The patch 3e9582267e3a: "ALSA: hda: Interrupt servicing and BDL setup
> > for compress streams" from Dec 2, 2022, leads to the following Smatch
> > static checker warning:
> >
> > sound/hda/hdac_stream.c:544 snd_hdac_stream_setup_periods()
> > error: uninitialized symbol 'dmab'.
> >
> > sound/hda/hdac_stream.c
> > 487 int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
> > 488 {
> > 489 struct hdac_bus *bus = azx_dev->bus;
> > 490 struct snd_pcm_substream *substream = azx_dev->substream;
> > 491 struct snd_compr_stream *cstream = azx_dev->cstream;
> > 492 struct snd_pcm_runtime *runtime = NULL;
> > 493 struct snd_dma_buffer *dmab;
> > 494 __le32 *bdl;
> > 495 int i, ofs, periods, period_bytes;
> > 496 int pos_adj, pos_align;
> > 497
> > 498 if (substream) {
> > 499 runtime = substream->runtime;
> > 500 dmab = snd_pcm_get_dma_buf(substream);
> > 501 } else if (cstream) {
> > 502 dmab = snd_pcm_get_dma_buf(cstream);
> > 503 }
> >
> > dmab is not initialized on else path.
>
> Hello,
>
> Thanks for the report. Perhaps I should just do: s/else if/else/ as
> the situation with ->substream AND ->cstream being uninitialized is
> invalid.
>
> Before support for compress stream was added in this part of the code,
> it was always assumed ->substream is valid.
>
> So, either s/else if/else or append:
> } else {
> return -EINVAL;
> }
>
> Takashi, what do you think?
The return -EINVAL would be OK. As this must not happen, it can be
even with WARN_ON().
thanks,
Takashi
prev parent reply other threads:[~2022-12-07 16:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 14:28 [bug report] ALSA: hda: Interrupt servicing and BDL setup for compress streams Dan Carpenter
2022-12-07 14:35 ` Cezary Rojewski
2022-12-07 16:55 ` Takashi Iwai [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=875yen9ms3.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=cezary.rojewski@intel.com \
--cc=error27@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.