Re: [PATCH v8] usb: dwc3: debugfs: Prevent any register access when devices is runtime suspended

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Udipto,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Udipto-Goswami/usb-dwc3-debugfs-Prevent-any-register-access-when-devices-is-runtime-suspended/20230504-125225
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20230504045052.22347-1-quic_ugoswami%40quicinc.com
patch subject: [PATCH v8] usb: dwc3: debugfs: Prevent any register access when devices is runtime suspended
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20230510/202305101451.V2D0cM4S-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Link: https://lore.kernel.org/r/202305101451.V2D0cM4S-lkp@xxxxxxxxx/

New smatch warnings:
drivers/usb/dwc3/debugfs.c:647 dwc3_link_state_write() warn: missing error code? 'ret'
drivers/usb/dwc3/debugfs.c:720 dwc3_rx_fifo_size_show() warn: curly braces intended?
drivers/usb/dwc3/debugfs.c:722 dwc3_rx_fifo_size_show() warn: inconsistent indenting
drivers/usb/dwc3/debugfs.c:722 dwc3_rx_fifo_size_show() warn: ignoring unreachable code.

Old smatch warnings:
drivers/usb/dwc3/debugfs.c:657 dwc3_link_state_write() warn: missing error code? 'ret'

vim +/ret +647 drivers/usb/dwc3/debugfs.c

1c53edaeee3338 Udipto Goswami 2023-05-04  638  	ret = pm_runtime_resume_and_get(dwc->dev);
1c53edaeee3338 Udipto Goswami 2023-05-04  639  	if (ret < 0)
1c53edaeee3338 Udipto Goswami 2023-05-04  640  		return ret;
1c53edaeee3338 Udipto Goswami 2023-05-04  641  
138801aaa566ec Felipe Balbi   2012-01-02  642  	spin_lock_irqsave(&dwc->lock, flags);
d102444cac1564 Thinh Nguyen   2018-11-07  643  	reg = dwc3_readl(dwc->regs, DWC3_GSTS);
d102444cac1564 Thinh Nguyen   2018-11-07  644  	if (DWC3_GSTS_CURMOD(reg) != DWC3_GSTS_CURMOD_DEVICE) {
d102444cac1564 Thinh Nguyen   2018-11-07  645  		spin_unlock_irqrestore(&dwc->lock, flags);
1c53edaeee3338 Udipto Goswami 2023-05-04  646  		pm_runtime_put_sync(dwc->dev);
1c53edaeee3338 Udipto Goswami 2023-05-04 @647  		return ret;

ret is not necessarily an error code.

d102444cac1564 Thinh Nguyen   2018-11-07  648  	}
d102444cac1564 Thinh Nguyen   2018-11-07  649  
0d36dede457873 Thinh Nguyen   2018-11-07  650  	reg = dwc3_readl(dwc->regs, DWC3_DSTS);
0d36dede457873 Thinh Nguyen   2018-11-07  651  	speed = reg & DWC3_DSTS_CONNECTSPD;
0d36dede457873 Thinh Nguyen   2018-11-07  652  
0d36dede457873 Thinh Nguyen   2018-11-07  653  	if (speed < DWC3_DSTS_SUPERSPEED &&
0d36dede457873 Thinh Nguyen   2018-11-07  654  	    state != DWC3_LINK_STATE_RECOV) {
0d36dede457873 Thinh Nguyen   2018-11-07  655  		spin_unlock_irqrestore(&dwc->lock, flags);
1c53edaeee3338 Udipto Goswami 2023-05-04  656  		pm_runtime_put_sync(dwc->dev);
1c53edaeee3338 Udipto Goswami 2023-05-04  657  		return ret;
0d36dede457873 Thinh Nguyen   2018-11-07  658  	}

[ snip ]

2c85a1817e4ba0 Thinh Nguyen   2018-11-07  708  static int dwc3_rx_fifo_size_show(struct seq_file *s, void *unused)
818ec3aba883f5 Felipe Balbi   2016-04-14  709  {
818ec3aba883f5 Felipe Balbi   2016-04-14  710  	struct dwc3_ep		*dep = s->private;
818ec3aba883f5 Felipe Balbi   2016-04-14  711  	struct dwc3		*dwc = dep->dwc;
818ec3aba883f5 Felipe Balbi   2016-04-14  712  	unsigned long		flags;
d00be779cc5016 Thinh Nguyen   2021-03-27  713  	u32			mdwidth;
818ec3aba883f5 Felipe Balbi   2016-04-14  714  	u32			val;
1c53edaeee3338 Udipto Goswami 2023-05-04  715  	int			ret;
1c53edaeee3338 Udipto Goswami 2023-05-04  716  
1c53edaeee3338 Udipto Goswami 2023-05-04  717  	ret = pm_runtime_resume_and_get(dwc->dev);
1c53edaeee3338 Udipto Goswami 2023-05-04  718  	if (ret < 0)
1c53edaeee3338 Udipto Goswami 2023-05-04  719  		pm_runtime_put_sync(dwc->dev);
1c53edaeee3338 Udipto Goswami 2023-05-04 @720  		return ret;

Needs curly braces.

818ec3aba883f5 Felipe Balbi   2016-04-14  721  
818ec3aba883f5 Felipe Balbi   2016-04-14 @722  	spin_lock_irqsave(&dwc->lock, flags);
2c85a1817e4ba0 Thinh Nguyen   2018-11-07  723  	val = dwc3_core_fifo_space(dep, DWC3_RXFIFO);
0f874f79dc81ae Thinh Nguyen   2018-11-07  724  
0f874f79dc81ae Thinh Nguyen   2018-11-07  725  	/* Convert to bytes */
d00be779cc5016 Thinh Nguyen   2021-03-27  726  	mdwidth = dwc3_mdwidth(dwc);
4244ba02edb850 Thinh Nguyen   2020-04-11  727  
4244ba02edb850 Thinh Nguyen   2020-04-11  728  	val *= mdwidth;
0f874f79dc81ae Thinh Nguyen   2018-11-07  729  	val >>= 3;
818ec3aba883f5 Felipe Balbi   2016-04-14  730  	seq_printf(s, "%u\n", val);
818ec3aba883f5 Felipe Balbi   2016-04-14  731  	spin_unlock_irqrestore(&dwc->lock, flags);
818ec3aba883f5 Felipe Balbi   2016-04-14  732  
1c53edaeee3338 Udipto Goswami 2023-05-04  733  	pm_runtime_put_sync(dwc->dev);
818ec3aba883f5 Felipe Balbi   2016-04-14  734  	return 0;
818ec3aba883f5 Felipe Balbi   2016-04-14  735  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux