[alsa-devel] ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets()

Dan Carpenter dan.carpenter at oracle.com
Tue Aug 4 19:38:50 CEST 2015


Hello Lars-Peter Clausen,

The patch 1ce43acff0c0: "ASoC: dapm: Simplify list creation in
dapm_dai_get_connected_widgets()" from Jul 26, 2015, leads to the
following static checker warning:

	sound/soc/soc-dapm.c:1199 snd_soc_dapm_dai_get_connected_widgets()
	warn: inconsistent returns 'mutex:&card->dapm_mutex'.
	  Locked on:   line 1194
	  Unlocked on: line 1199

sound/soc/soc-dapm.c
  1164  int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
  1165          struct snd_soc_dapm_widget_list **list)
  1166  {
  1167          struct snd_soc_card *card = dai->component->card;
  1168          struct snd_soc_dapm_widget *w;
  1169          LIST_HEAD(widgets);
  1170          int paths;
  1171          int ret;
  1172  
  1173          mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
  1174  
  1175          /*
  1176           * For is_connected_{output,input}_ep fully discover the graph we need
  1177           * to reset the cached number of inputs and outputs.
  1178           */
  1179          list_for_each_entry(w, &card->widgets, list) {
  1180                  w->inputs = -1;
  1181                  w->outputs = -1;
  1182          }
  1183  
  1184          if (stream == SNDRV_PCM_STREAM_PLAYBACK)
  1185                  paths = is_connected_output_ep(dai->playback_widget, &widgets);
  1186          else
  1187                  paths = is_connected_input_ep(dai->capture_widget, &widgets);
  1188  
  1189          /* Drop starting point */
  1190          list_del(widgets.next);
  1191  
  1192          ret = dapm_widget_list_create(list, &widgets);
  1193          if (ret)
  1194                  return ret;
                        ^^^^^^^^^^^
Holding card->dapm_mutex.

  1195  
  1196          trace_snd_soc_dapm_connected(paths, stream);
  1197          mutex_unlock(&card->dapm_mutex);
  1198  
  1199          return paths;
  1200  }

regards,
dan carpenter


More information about the Alsa-devel mailing list