[alsa-devel] ASoC: core: Call mute for cpu dais as well
Babu, Ramesh
ramesh.babu at intel.com
Tue Dec 2 18:13:40 CET 2014
> This is a semi-automatic email about new static checker warnings.
>
> The patch ae11601b80b9: "ASoC: core: Call mute for cpu dais as well"
> from Oct 15, 2014, leads to the following Smatch complaint:
>
> sound/soc/soc-pcm.c:777 soc_pcm_prepare()
> error: we previously assumed 'cpu_dai->driver->ops' could be null
> (see line 755)
>
> sound/soc/soc-pcm.c
> 754
> 755 if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare)
> {
> ^^^^^^^^^^^^^^^^^^^^ I don't think this can be NULL. Probably
> we should remove this check.
Nope. ops can be NULL.
>
> 756 ret = cpu_dai->driver->ops->prepare(substream,
> cpu_dai);
> 757 if (ret < 0) {
> 758 dev_err(cpu_dai->dev, "ASoC: DAI prepare
> error: %d\n",
> 759 ret);
> 760 goto out;
> 761 }
> 762 }
> 763
> 764 /* cancel any delayed stream shutdown that is pending */
> 765 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
> &&
> 766 rtd->pop_wait) {
> 767 rtd->pop_wait = 0;
> 768 cancel_delayed_work(&rtd->delayed_work);
> 769 }
> 770
> 771 snd_soc_dapm_stream_event(rtd, substream->stream,
> 772 SND_SOC_DAPM_STREAM_START);
> 773
> 774 for (i = 0; i < rtd->num_codecs; i++)
> 775 snd_soc_dai_digital_mute(rtd->codec_dais[i], 0,
> 776 substream->stream);
> 777 snd_soc_dai_digital_mute(cpu_dai, 0, substream->stream);
> ^^^^^^^ But if it were NULL then this newly introduced
> function call would Oops.
>
I think the fix needs to be inside the snd_soc_dai_digital_mute().
Instead of checking dai->driver, it needs to check for dai->driver->ops.
It applies multple functions in soc-core.c.
More information about the Alsa-devel
mailing list