alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Re: ASoC: core: Call mute for cpu dais as well
@ 2014-11-27 16:15 Dan Carpenter
  2014-12-02 17:13 ` Babu, Ramesh
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-11-27 16:15 UTC (permalink / raw)
  To: ramesh.babu; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ASoC: core: Call mute for cpu dais as well
  2014-11-27 16:15 ASoC: core: Call mute for cpu dais as well Dan Carpenter
@ 2014-12-02 17:13 ` Babu, Ramesh
  2014-12-02 19:26   ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Babu, Ramesh @ 2014-12-02 17:13 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: alsa-devel@alsa-project.org

> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ASoC: core: Call mute for cpu dais as well
  2014-12-02 17:13 ` Babu, Ramesh
@ 2014-12-02 19:26   ` Lars-Peter Clausen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-12-02 19:26 UTC (permalink / raw)
  To: Babu, Ramesh, Dan Carpenter; +Cc: alsa-devel@alsa-project.org

On 12/02/2014 06:13 PM, Babu, Ramesh wrote:
>> 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.

It can't. If it is the core will update it to point to null_dai_ops.

- Lars

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-02 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 16:15 ASoC: core: Call mute for cpu dais as well Dan Carpenter
2014-12-02 17:13 ` Babu, Ramesh
2014-12-02 19:26   ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).