tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 6ebf211bb11dfc004a2ff73a9de5386fa309c430 commit: 6aa60f79e6794bbbc571ea4e0501b9fcc26026e2 [3454/5042] dmaengine: fsl-edma: add safety check for 'srcid' config: i386-randconfig-141-20240411 (https://download.01.org/0day-ci/archive/20240411/202404110915.riwV3ZAC-lkp@xxxxxxxxx/config) compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.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 <lkp@xxxxxxxxx> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> | Closes: https://lore.kernel.org/r/202404110915.riwV3ZAC-lkp@xxxxxxxxx/ smatch warnings: drivers/dma/fsl-edma-main.c:133 fsl_edma_xlate() warn: inconsistent returns '&fsl_edma->fsl_edma_mutex'. vim +133 drivers/dma/fsl-edma-main.c d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 96 static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec, d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 97 struct of_dma *ofdma) d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 98 { d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 99 struct fsl_edma_engine *fsl_edma = ofdma->of_dma_data; 178c81e58e9155 drivers/dma/fsl-edma.c Jingchang Lu 2014-02-21 100 struct dma_chan *chan, *_chan; 82d149b86d31e1 drivers/dma/fsl-edma.c Yuan Yao 2015-10-30 101 struct fsl_edma_chan *fsl_chan; af802728e4ab07 drivers/dma/fsl-edma.c Robin Gong 2019-06-25 102 u32 dmamux_nr = fsl_edma->drvdata->dmamuxs; af802728e4ab07 drivers/dma/fsl-edma.c Robin Gong 2019-06-25 103 unsigned long chans_per_mux = fsl_edma->n_chans / dmamux_nr; d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 104 d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 105 if (dma_spec->args_count != 2) d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 106 return NULL; d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 107 d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 108 mutex_lock(&fsl_edma->fsl_edma_mutex); 178c81e58e9155 drivers/dma/fsl-edma.c Jingchang Lu 2014-02-21 109 list_for_each_entry_safe(chan, _chan, &fsl_edma->dma_dev.channels, device_node) { d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 110 if (chan->client_count) d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 111 continue; 211bfef7c2bc8c drivers/dma/fsl-edma.c Jingchang Lu 2014-07-01 112 if ((chan->chan_id / chans_per_mux) == dma_spec->args[0]) { d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 113 chan = dma_get_slave_channel(chan); d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 114 if (chan) { d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 115 chan->device->privatecnt++; 82d149b86d31e1 drivers/dma/fsl-edma.c Yuan Yao 2015-10-30 116 fsl_chan = to_fsl_edma_chan(chan); cee8cbfc7be8ff drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 117 fsl_chan->srcid = dma_spec->args[1]; 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 118 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 119 if (!fsl_chan->srcid) { 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 120 dev_err(&fsl_chan->pdev->dev, "Invalidate srcid %d\n", 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 121 fsl_chan->srcid); mutex_unlock(&fsl_edma->fsl_edma_mutex); before returning 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 122 return NULL; 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 123 } 6aa60f79e6794b drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 124 cee8cbfc7be8ff drivers/dma/fsl-edma-main.c Frank Li 2024-03-23 125 fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid, 82d149b86d31e1 drivers/dma/fsl-edma.c Yuan Yao 2015-10-30 126 true); d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 127 mutex_unlock(&fsl_edma->fsl_edma_mutex); d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 128 return chan; d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 129 } d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 130 } d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 131 } d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 132 mutex_unlock(&fsl_edma->fsl_edma_mutex); d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 @133 return NULL; d6be34fbd39b7d drivers/dma/fsl-edma.c Jingchang Lu 2014-02-18 134 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki