Skip to contentSkip to conversation

ASoC: davinci-mcasp: Choose PCM driver based on configured DMA controller

DISCUSSION Dan Carpenter 2 participants 2 messages Jun 11, 2015

lore
Share & tools
lore
#0 lore raw

Hello Jyri Sarha,

The patch 9fbd58cf4ab0: "ASoC: davinci-mcasp: Choose PCM driver based on configured DMA controller" from Jun 2, 2015, leads to the following static checker warning:

sound/soc/davinci/davinci-mcasp.c:1842 davinci_mcasp_probe()
info: ignoring unreachable code.

sound/soc/davinci/davinci-mcasp.c
1812 switch (ret) {
1813 case PCM_EDMA:
1814 #if IS_BUILTIN(CONFIG_SND_EDMA_SOC) || \
1815 (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
1816 IS_MODULE(CONFIG_SND_EDMA_SOC))
1817 ret = edma_pcm_platform_register(&pdev->dev);
1818 #else

  1819                  dev_err(&pdev->dev, "Missing SND_EDMA_SOC\n");
  1820                  ret = -EINVAL;
  1821                  goto err;
  1822  #endif
  1823                  break;
  1824          case PCM_SDMA:
  1825  #if IS_BUILTIN(CONFIG_SND_OMAP_SOC) || \
  1826          (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
  1827           IS_MODULE(CONFIG_SND_OMAP_SOC))
  1828                  ret = omap_pcm_platform_register(&pdev->dev);
  1829  #else
  1830                  dev_err(&pdev->dev, "Missing SND_SDMA_SOC\n");
  1831                  ret = -EINVAL;
  1832                  goto err;

1833 #endif
1834 break;
1835 default:
1836 dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
1837 case -EPROBE_DEFER:
1838 goto err;
1839 break;
1840 }
1841

Depending on the ifdefs then this is reachable, I guess...

  1842          if (ret) {
  1843                  dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
  1844                  goto err;
  1845          }
  1846  
  1847          return 0;
  1848  
  1849  err:
  1850          pm_runtime_disable(&pdev->dev);
  1851          return ret;
  1852  }
  1853  

regards,
dan carpenter

#1 lore raw
Quoted 41 lines · Dan Carpenter

Hello Jyri Sarha,

The patch 9fbd58cf4ab0: "ASoC: davinci-mcasp: Choose PCM driver based on configured DMA controller" from Jun 2, 2015, leads to the following static checker warning:

sound/soc/davinci/davinci-mcasp.c:1842 davinci_mcasp_probe()
info: ignoring unreachable code.

sound/soc/davinci/davinci-mcasp.c

   1812          switch (ret) {
   1813          case PCM_EDMA:
   1814  #if IS_BUILTIN(CONFIG_SND_EDMA_SOC) || \
   1815          (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
   1816           IS_MODULE(CONFIG_SND_EDMA_SOC))
   1817                  ret = edma_pcm_platform_register(&pdev->dev);
   1818  #else
   1819                  dev_err(&pdev->dev, "Missing SND_EDMA_SOC\n");
   1820                  ret = -EINVAL;
   1821                  goto err;
   1822  #endif
   1823                  break;
   1824          case PCM_SDMA:
   1825  #if IS_BUILTIN(CONFIG_SND_OMAP_SOC) || \
   1826          (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
   1827           IS_MODULE(CONFIG_SND_OMAP_SOC))
   1828                  ret = omap_pcm_platform_register(&pdev->dev);
   1829  #else
   1830                  dev_err(&pdev->dev, "Missing SND_SDMA_SOC\n");
   1831                  ret = -EINVAL;
   1832                  goto err;
   1833  #endif
   1834                  break;
   1835          default:
   1836                  dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
   1837          case -EPROBE_DEFER:
   1838                  goto err;
   1839                  break;
   1840          }
   1841
Quoted 1 line

Depending on the ifdefs then this is reachable, I guess...

Yes it is. I could remove the "goto err;" from #else branches to silence the warning. That would cause a double error print for a single issue... either way is Ok by me.

Best regards,
Jyri

Quoted 17 lines
   1842          if (ret) {
   1843                  dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
   1844                  goto err;
   1845          }
   1846
   1847          return 0;
   1848
   1849  err:
   1850          pm_runtime_disable(&pdev->dev);
   1851          return ret;
   1852  }
   1853

regards,
dan carpenter