ASoC: core: Call mute for cpu dais as well
Hello Ramesh Babu,
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.
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.
778
779 out:
regards,
dan carpenter
Quoted 7 lines
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:777soc_pcm_prepare()error: we previously assumed 'cpu_dai->driver->ops' could be null
Quoted 8 lines
(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. Probablywe should remove this check.
Nope. ops can be NULL.
Quoted 27 lines
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 introducedQuoted 2 lines
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.
Quoted 9 lines · Ramesh
Quoted 9 lines
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:777soc_pcm_prepare()error: we previously assumed 'cpu_dai->driver->ops' could be null(see line 755)
Quoted 7 lines
Quoted 6 lines
sound/soc/soc-pcm.c754 755 if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) { ^^^^^^^^^^^^^^^^^^^^ I don't think this can be NULL. Probablywe should remove this check.
Nope. ops can be NULL.
It can't. If it is the core will update it to point to null_dai_ops.
- Lars