[alsa-devel] [bug report] ASoC: dapm: Move connection of CODEC to CODEC DAIs

Dan Carpenter dan.carpenter at oracle.com
Fri Sep 7 20:55:06 CEST 2018


Hello Charles Keepax,

The patch 778ff5bb8689: "ASoC: dapm: Move connection of CODEC to
CODEC DAIs" from Sep 5, 2018, leads to the following static checker
warning:

    sound/soc/soc-dapm.c:4089 dapm_connect_dai_link_widgets()
    error: 'playback' dereferencing possible ERR_PTR()

    sound/soc/soc-dapm.c:4110 dapm_connect_dai_link_widgets()
    error: 'capture' dereferencing possible ERR_PTR()

sound/soc/soc-dapm.c
  4077  
  4078          for_each_rtd_codec_dai(rtd, i, codec_dai) {
  4079  
  4080                  /* connect BE DAI playback if widgets are valid */
  4081                  codec = codec_dai->playback_widget;
  4082  
  4083                  if (playback_cpu && codec) {
  4084                          if (!playback) {
  4085                                  playback = snd_soc_dapm_new_dai(card, rtd,
  4086                                                                  playback_cpu,
  4087                                                                  codec);
  4088  
  4089                                  snd_soc_dapm_add_path(&card->dapm, playback_cpu,
  4090                                                        playback, NULL, NULL);
                                                              ^^^^^^^^
snd_soc_dapm_new_dai() returns error pointers.

  4091                          }
  4092  
  4093                          dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
  4094                                  cpu_dai->component->name, playback_cpu->name,
  4095                                  codec_dai->component->name, codec->name);
  4096  
  4097                          snd_soc_dapm_add_path(&card->dapm, playback, codec,
  4098                                                NULL, NULL);
  4099                  }
  4100  
  4101                  /* connect BE DAI capture if widgets are valid */
  4102                  codec = codec_dai->capture_widget;
  4103  
  4104                  if (codec && capture_cpu) {
  4105                          if (!capture) {
  4106                                  capture = snd_soc_dapm_new_dai(card, rtd,
  4107                                                                 codec,
  4108                                                                 capture_cpu);
  4109  
  4110                                  snd_soc_dapm_add_path(&card->dapm, capture,
  4111                                                        capture_cpu, NULL, NULL);
                                                              ^^^^^^^^^^^
  4112                          }
  4113  
  4114                          dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
  4115                                  codec_dai->component->name, codec->name,
  4116                                  cpu_dai->component->name, capture_cpu->name);
  4117  
  4118                          snd_soc_dapm_add_path(&card->dapm, codec, capture,
  4119                                                NULL, NULL);

regards,
dan carpenter


More information about the Alsa-devel mailing list