[bug report] ASoC: soc-dai: return proper error for get_sdw_stream()

dan.carpenter at oracle.com dan.carpenter at oracle.com
Fri Jul 17 11:40:53 CEST 2020


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


More information about the Alsa-devel mailing list