sound/soc/renesas/rcar/msiof.c:367 msiof_open() warn: passing zero to 'PTR_ERR'
PATCH 21/24 sound/soc/renesas/rcar/msiof.c:367 msiof_open() warn: passing zero to 'PTR_ERR'
tree: https://github.com/morimoto/linux sound-msiof-2025-03-26 head: ba9316799e85a9ef14dd8a3e5580be4c97149576 commit: adf5f819442084ec2b0ea13a5834b05d10750e24 [21/24] ASoC: renesas: add MSIOF sound support config: openrisc-randconfig-r071-20250407 (https://download.01.org/0day-ci/archive/20250407/[email protected]/config) compiler: or1k-linux-gcc (GCC) 10.5.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:sound/soc/renesas/rcar/msiof.c:367 msiof_open() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +367 sound/soc/renesas/rcar/msiof.c
adf5f819442084e Kuninori Morimoto 2025-03-24 356 static int msiof_open(struct snd_soc_component *component,
adf5f819442084e Kuninori Morimoto 2025-03-24 357 struct snd_pcm_substream *substream)
adf5f819442084e Kuninori Morimoto 2025-03-24 358 {
adf5f819442084e Kuninori Morimoto 2025-03-24 359 struct device *dev = component->dev;
adf5f819442084e Kuninori Morimoto 2025-03-24 360 struct dma_chan *chan;
adf5f819442084e Kuninori Morimoto 2025-03-24 361 static const char *dma_names[] = {"rx", "tx"};
adf5f819442084e Kuninori Morimoto 2025-03-24 362 int is_play = msiof_is_play(substream);
adf5f819442084e Kuninori Morimoto 2025-03-24 363 int ret;
adf5f819442084e Kuninori Morimoto 2025-03-24 364
adf5f819442084e Kuninori Morimoto 2025-03-24 365 chan = of_dma_request_slave_channel(dev->of_node, dma_names[is_play]);
adf5f819442084e Kuninori Morimoto 2025-03-24 366 if (IS_ERR_OR_NULL(chan))of_dma_request_slave_channel() can't return NULL, but the zero-day bot doesn't do cross function analysis and the IS_ERR_OR_NULL() check tricks Smatch into thinking "chan" can be NULL.
adf5f819442084e Kuninori Morimoto 2025-03-24 @367 return PTR_ERR(chan);
adf5f819442084e Kuninori Morimoto 2025-03-24 368 adf5f819442084e Kuninori Morimoto 2025-03-24 369 ret = snd_dmaengine_pcm_open(substream, chan); adf5f819442084e Kuninori Morimoto 2025-03-24 370 if (ret < 0) adf5f819442084e Kuninori Morimoto 2025-03-24 371 goto open_err_dma; adf5f819442084e Kuninori Morimoto 2025-03-24 372 adf5f819442084e Kuninori Morimoto 2025-03-24 373 snd_soc_set_runtime_hwparams(substream, &msiof_pcm_hardware); adf5f819442084e Kuninori Morimoto 2025-03-24 374 adf5f819442084e Kuninori Morimoto 2025-03-24 375 ret = snd_pcm_hw_constraint_integer(substream->runtime, SNDRV_PCM_HW_PARAM_PERIODS); adf5f819442084e Kuninori Morimoto 2025-03-24 376 adf5f819442084e Kuninori Morimoto 2025-03-24 377 open_err_dma: adf5f819442084e Kuninori Morimoto 2025-03-24 378 if (ret < 0) adf5f819442084e Kuninori Morimoto 2025-03-24 379 dma_release_channel(chan); adf5f819442084e Kuninori Morimoto 2025-03-24 380 adf5f819442084e Kuninori Morimoto 2025-03-24 381 return ret; adf5f819442084e Kuninori Morimoto 2025-03-24 382 }
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Dan
Quoted 12 lines
adf5f819442084e Kuninori Morimoto 2025-03-24 356 static int msiof_open(struct snd_soc_component *component,
adf5f819442084e Kuninori Morimoto 2025-03-24 357 struct snd_pcm_substream *substream)
adf5f819442084e Kuninori Morimoto 2025-03-24 358 {
adf5f819442084e Kuninori Morimoto 2025-03-24 359 struct device *dev = component->dev;
adf5f819442084e Kuninori Morimoto 2025-03-24 360 struct dma_chan *chan;
adf5f819442084e Kuninori Morimoto 2025-03-24 361 static const char *dma_names[] = {"rx", "tx"};
adf5f819442084e Kuninori Morimoto 2025-03-24 362 int is_play = msiof_is_play(substream);
adf5f819442084e Kuninori Morimoto 2025-03-24 363 int ret;
adf5f819442084e Kuninori Morimoto 2025-03-24 364
adf5f819442084e Kuninori Morimoto 2025-03-24 365 chan = of_dma_request_slave_channel(dev->of_node, dma_names[is_play]);
adf5f819442084e Kuninori Morimoto 2025-03-24 366 if (IS_ERR_OR_NULL(chan))Quoted 3 lines
of_dma_request_slave_channel()can't return NULL, but the zero-day bot doesn't do cross function analysis and theIS_ERR_OR_NULL()check tricks Smatch into thinking "chan" can be NULL.
Thank you for pointing it.
Will fix in v2 patch
Thank you for your help !!
Best regards
---
Kuninori Morimoto