[staging:staging-testing 62/88] drivers/staging/emxx_udc/emxx_udc.c:839:9: warning: Variable 'result' is reassigned a value before the old one has been used.

Alex Dewar alex.dewar90 at gmail.com
Wed Sep 2 15:33:00 UTC 2020


On Wed, Sep 02, 2020 at 11:15:47AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
> head:   4c6491a343e91a5a2a699b0b545f8ba1ec1e8c65
> commit: fbcfdfab4a2c4ec5e2195929528506fec39388f3 [62/88] staging: emxx_udc: Allow for building on !ARM
> compiler: riscv32-linux-gcc (GCC) 9.3.0

[snip]

> >> drivers/staging/emxx_udc/emxx_udc.c:2095:48: warning: Uninitialized variable: ep [uninitvar]
>     list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
>                                                   ^
This warning's bogus. The ep here refers to a member name, not the
variable ep. I'll send a patch for the other warnings though.

> 
> # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?id=fbcfdfab4a2c4ec5e2195929528506fec39388f3
> git remote add staging https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> git fetch --no-tags staging staging-testing
> git checkout fbcfdfab4a2c4ec5e2195929528506fec39388f3
> vim +/result +839 drivers/staging/emxx_udc/emxx_udc.c
> 
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  785  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  786  /*-------------------------------------------------------------------------*/
> e2d34dfdffcfd1 Cristian Sicilia    2018-11-17  787  static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req,
> e2d34dfdffcfd1 Cristian Sicilia    2018-11-17  788  			   u32 num, u32 length)
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  789  {
> 5a012f67cbcb20 Alexis Lothoré      2017-05-10  790  	dma_addr_t	p_buffer;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  791  	u32		mpkt;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  792  	u32		lmpkt;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  793  	u32		dmacnt;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  794  	u32		burst = 1;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  795  	u32		data;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  796  	int		result = -EINVAL;
> 64407f6e7d158e Carmeli Tamir       2018-11-07  797  	struct fc_regs __iomem *preg = udc->p_regs;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  798  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  799  	if (req->dma_flag)
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  800  		return 1;		/* DMA is forwarded */
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  801  
> 8b77d94e69c33f Saiyam Doshi        2019-09-08  802  	req->dma_flag = true;
> 5a012f67cbcb20 Alexis Lothoré      2017-05-10  803  	p_buffer = req->req.dma;
> 5a012f67cbcb20 Alexis Lothoré      2017-05-10  804  	p_buffer += req->req.actual;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  805  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  806  	/* DMA Address */
> 5a012f67cbcb20 Alexis Lothoré      2017-05-10  807  	_nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  808  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  809  	/* Number of transfer packets */
> 75d9c393763da3 Alexis Lothoré      2017-05-10  810  	mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT;
> 599b87809594e2 Janani Ravichandran 2016-02-11  811  	dmacnt = length / mpkt;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  812  	lmpkt = (length % mpkt) & ~(u32)0x03;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  813  
> 2866914ce1f84f Cristina Moraru     2015-09-29  814  	if (dmacnt > DMA_MAX_COUNT) {
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  815  		dmacnt = DMA_MAX_COUNT;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  816  		lmpkt = 0;
> 2866914ce1f84f Cristina Moraru     2015-09-29  817  	} else if (lmpkt != 0) {
> 2866914ce1f84f Cristina Moraru     2015-09-29  818  		if (dmacnt == 0)
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  819  			burst = 0;	/* Burst OFF */
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  820  		dmacnt++;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  821  	}
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  822  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  823  	data = mpkt | (lmpkt << 16);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  824  	_nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  825  
> 75d9c393763da3 Alexis Lothoré      2017-05-10  826  	data = ((dmacnt & 0xff) << 16) | DCR1_EPN_DIR0 | DCR1_EPN_REQEN;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  827  	_nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  828  
> 2866914ce1f84f Cristina Moraru     2015-09-29  829  	if (burst == 0) {
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  830  		_nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, 0);
> 75d9c393763da3 Alexis Lothoré      2017-05-10  831  		_nbu2ss_bitclr(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  832  	} else {
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  833  		_nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  834  				, (dmacnt << 16));
> 75d9c393763da3 Alexis Lothoré      2017-05-10  835  		_nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  836  	}
> 75d9c393763da3 Alexis Lothoré      2017-05-10  837  	_nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN);
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  838  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06 @839  	result = length & ~(u32)0x03;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  840  	req->div_len = result;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  841  
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  842  	return result;
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  843  }
> 33aa8d45a4fea3 Magnus Damm         2014-06-06  844  
> 
> :::::: The code at line 839 was first introduced by commit
> :::::: 33aa8d45a4fea3dc5d90338aad0867a66e0c38d5 staging: emxx_udc: Add Emma Mobile USB Gadget driver
> 
> :::::: TO: Magnus Damm <damm+renesas at opensource.se>
> :::::: CC: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


More information about the devel mailing list