Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio
@ 2017-02-11  5:11 Dan Carpenter
  2017-02-14 13:32 ` Jeeja KP
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-02-11  5:11 UTC (permalink / raw)
  To: jeeja.kp; +Cc: alsa-devel

Hello Jeeja KP,

The patch 754695f9960b: "ASoC: hdac_hdmi: Begin to add support for DP
Multi-stream audio" from Feb 6, 2017, leads to the following static
checker warning:

	sound/soc/codecs/hdac_hdmi.c:742 hdac_hdmi_set_pin_port_mux()
	error: we previously assumed 'pcm->port' could be null (see line 741)

sound/soc/codecs/hdac_hdmi.c
   719  static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
   720                  struct snd_ctl_elem_value *ucontrol)
   721  {
   722          int ret;
   723          struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
   724          struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol);
   725          struct snd_soc_dapm_context *dapm = w->dapm;
   726          struct hdac_hdmi_port *port = w->priv;
   727          struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev);
   728          struct hdac_hdmi_priv *hdmi = edev->private_data;
   729          struct hdac_hdmi_pcm *pcm = NULL;
   730          const char *cvt_name =  e->texts[ucontrol->value.enumerated.item[0]];
   731  
   732          ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
   733          if (ret < 0)
   734                  return ret;
   735  
   736          if (port == NULL)
   737                  return -EINVAL;
   738  
   739          mutex_lock(&hdmi->pin_mutex);
   740          list_for_each_entry(pcm, &hdmi->pcm_list, head) {
   741                  if (!pcm->port && pcm->port == port &&
                             ^^^^^^^^^
test

   742                          pcm->port->id == port->id)
                                ^^^^^^^^^^^^^
dereference

   743                          pcm->port = NULL;
                                ^^^^^^^^^^^^^^^^
Perhaps the NULL test is reversed?

   744  
   745                  /*
   746                   * Jack status is not reported during device probe as the
   747                   * PCMs are not registered by then. So report it here.
   748                   */


regards,
dan carpenter

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

* Re: [bug report] ASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio
  2017-02-11  5:11 [bug report] ASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio Dan Carpenter
@ 2017-02-14 13:32 ` Jeeja KP
  0 siblings, 0 replies; 2+ messages in thread
From: Jeeja KP @ 2017-02-14 13:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: alsa-devel

On Sat, Feb 11, 2017 at 08:11:23AM +0300, Dan Carpenter wrote:
> Hello Jeeja KP,
> 
> The patch 754695f9960b: "ASoC: hdac_hdmi: Begin to add support for DP
> Multi-stream audio" from Feb 6, 2017, leads to the following static
> checker warning:
> 
> 	sound/soc/codecs/hdac_hdmi.c:742 hdac_hdmi_set_pin_port_mux()
> 	error: we previously assumed 'pcm->port' could be null (see line 741)
> 
> sound/soc/codecs/hdac_hdmi.c
>    719  static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
>    720                  struct snd_ctl_elem_value *ucontrol)
>    721  {
>    722          int ret;
>    723          struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
>    724          struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol);
>    725          struct snd_soc_dapm_context *dapm = w->dapm;
>    726          struct hdac_hdmi_port *port = w->priv;
>    727          struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev);
>    728          struct hdac_hdmi_priv *hdmi = edev->private_data;
>    729          struct hdac_hdmi_pcm *pcm = NULL;
>    730          const char *cvt_name =  e->texts[ucontrol->value.enumerated.item[0]];
>    731  
>    732          ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
>    733          if (ret < 0)
>    734                  return ret;
>    735  
>    736          if (port == NULL)
>    737                  return -EINVAL;
>    738  
>    739          mutex_lock(&hdmi->pin_mutex);
>    740          list_for_each_entry(pcm, &hdmi->pcm_list, head) {
>    741                  if (!pcm->port && pcm->port == port &&
>                              ^^^^^^^^^
> test
> 
>    742                          pcm->port->id == port->id)
>                                 ^^^^^^^^^^^^^
> dereference
> 
>    743                          pcm->port = NULL;
>                                 ^^^^^^^^^^^^^^^^
> Perhaps the NULL test is reversed?
> 
>    744  
>    745                  /*
>    746                   * Jack status is not reported during device probe as the
>    747                   * PCMs are not registered by then. So report it here.
>    748                   */
> 
>

Thanks for Reporting.

This issue is fixed with DP MST patchs that are posted later and which is in
review list.

Regards,
Jeeja

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

end of thread, other threads:[~2017-02-14 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-11  5:11 [bug report] ASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio Dan Carpenter
2017-02-14 13:32 ` Jeeja KP

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox