tree:   https://github.com/plbossart/sound fix/soundwire-dev3
head:   be20d4ffe90df065bc8e9a5b16bc6a8c3283e7e1
commit: 3282039064bf3a47f32e580aee600e6423e42040 [61/64] [HACK]: SOF: bypass 
hardware to get driver to load

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

smatch warnings:
sound/soc/sof/pm.c:363 sof_suspend() error: uninitialized symbol 'ret'.

# 
https://github.com/plbossart/sound/commit/3282039064bf3a47f32e580aee600e6423e42040
git remote add plbossart-sound https://github.com/plbossart/sound
git remote update plbossart-sound
git checkout 3282039064bf3a47f32e580aee600e6423e42040
vim +/ret +363 sound/soc/sof/pm.c

8920153c6 Liam Girdwood        2019-04-12  321  static int sof_suspend(struct 
device *dev, bool runtime_suspend)
8920153c6 Liam Girdwood        2019-04-12  322  {
8920153c6 Liam Girdwood        2019-04-12  323          struct snd_sof_dev 
*sdev = dev_get_drvdata(dev);
8920153c6 Liam Girdwood        2019-04-12  324          int ret;
8920153c6 Liam Girdwood        2019-04-12  325  
8920153c6 Liam Girdwood        2019-04-12  326          /* do nothing if dsp 
suspend callback is not set */
8920153c6 Liam Girdwood        2019-04-12  327          if 
(!sof_ops(sdev)->suspend)
8920153c6 Liam Girdwood        2019-04-12  328                  return 0;
8920153c6 Liam Girdwood        2019-04-12  329  
328203906 Pierre-Louis Bossart 2019-04-15  330  #if 
!IS_ENABLED(CONFIG_SOF_BYPASS_HARDWARE)

If CONFIG_SOF_BYPASS_HARDWARE is enabled then ret isn't initialized.

Btw, you can use IS_ENABLED() in code instead of at the pre-processor
stage.  It's kind of magical like that.

        if (IS_ENABLED(CONFIG_SOF_BYPASS_HARDWARE))
                return 0;

It's slightly prettier and maybe would have let GCC detect this bug.
The compiled code basically ends up the same because GCC removes
everything inside an "if (0) {" condition.

8920153c6 Liam Girdwood        2019-04-12  331          /* release trace */
8920153c6 Liam Girdwood        2019-04-12  332          
snd_sof_release_trace(sdev);
8920153c6 Liam Girdwood        2019-04-12  333  
8920153c6 Liam Girdwood        2019-04-12  334          /* set restore_stream 
for all streams during system suspend */
8920153c6 Liam Girdwood        2019-04-12  335          if (!runtime_suspend)
8920153c6 Liam Girdwood        2019-04-12  336                  
sof_set_hw_params_upon_resume(sdev);
8920153c6 Liam Girdwood        2019-04-12  337  
8920153c6 Liam Girdwood        2019-04-12  338  #if 
IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE)
8920153c6 Liam Girdwood        2019-04-12  339          /* cache debugfs 
contents during runtime suspend */
8920153c6 Liam Girdwood        2019-04-12  340          if (runtime_suspend)
8920153c6 Liam Girdwood        2019-04-12  341                  
sof_cache_debugfs(sdev);
8920153c6 Liam Girdwood        2019-04-12  342  #endif
8920153c6 Liam Girdwood        2019-04-12  343          /* notify DSP of 
upcoming power down */
8920153c6 Liam Girdwood        2019-04-12  344          ret = 
sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_SAVE);
8920153c6 Liam Girdwood        2019-04-12  345          if (ret < 0) {
8920153c6 Liam Girdwood        2019-04-12  346                  
dev_err(sdev->dev,
8920153c6 Liam Girdwood        2019-04-12  347                          "error: 
ctx_save ipc error during suspend %d\n",
8920153c6 Liam Girdwood        2019-04-12  348                          ret);
8920153c6 Liam Girdwood        2019-04-12  349                  return ret;
8920153c6 Liam Girdwood        2019-04-12  350          }
8920153c6 Liam Girdwood        2019-04-12  351  
8920153c6 Liam Girdwood        2019-04-12  352          /* power down all DSP 
cores */
8920153c6 Liam Girdwood        2019-04-12  353          if (runtime_suspend)
8920153c6 Liam Girdwood        2019-04-12  354                  ret = 
snd_sof_dsp_runtime_suspend(sdev, 0);
8920153c6 Liam Girdwood        2019-04-12  355          else
8920153c6 Liam Girdwood        2019-04-12  356                  ret = 
snd_sof_dsp_suspend(sdev, 0);
8920153c6 Liam Girdwood        2019-04-12  357          if (ret < 0)
8920153c6 Liam Girdwood        2019-04-12  358                  
dev_err(sdev->dev,
8920153c6 Liam Girdwood        2019-04-12  359                          "error: 
failed to power down DSP during suspend %d\n",
8920153c6 Liam Girdwood        2019-04-12  360                          ret);
328203906 Pierre-Louis Bossart 2019-04-15  361  #endif
8920153c6 Liam Girdwood        2019-04-12  362          
8920153c6 Liam Girdwood        2019-04-12 @363          return ret;
8920153c6 Liam Girdwood        2019-04-12  364  }
8920153c6 Liam Girdwood        2019-04-12  365  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to