Skip to contentSkip to conversation

ASoC: soc-dai: return proper error for get_sdw_stream()

bug report [email protected] 1 participant 1 message Jul 17, 2020

lore
Share & tools
lore
#0 lore raw

Hello Srinivas Kandagatla,

The patch 308811a327c3: "ASoC: soc-dai: return proper error for get_sdw_stream()" from Mar 16, 2020, leads to the following static checker warning:

drivers/soundwire/stream.c:1920 sdw_shutdown_stream()
error: 'sdw_stream' dereferencing possible ERR_PTR()

drivers/soundwire/stream.c
1902 void sdw_shutdown_stream(void *sdw_substream) 1903 {

  1904          struct snd_pcm_substream *substream = sdw_substream;
  1905          struct snd_soc_pcm_runtime *rtd = substream->private_data;
  1906          struct sdw_stream_runtime *sdw_stream;
  1907          struct snd_soc_dai *dai;
  1908  
  1909          /* Find stream from first CPU DAI */
  1910          dai = asoc_rtd_to_cpu(rtd, 0);
  1911  
  1912          sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We updated this to return error pointers as well as NULL but forgot to check the caller.

  1913  
  1914          if (!sdw_stream) {
  1915                  dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
  1916                  return;
  1917          }
  1918  
  1919          /* release memory */
  1920          kfree(sdw_stream->name);
  1921          sdw_release_stream(sdw_stream);
  1922  

regards,
dan carpenter