[xlnx:xlnx_rebase_v5.4 887/1697] drivers/usb/host/xhci-ring.c:957:34: warning: variable 'stream_id' set but not used

kernel test robot lkp at intel.com
Tue Jan 12 17:43:20 EST 2021


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4
head:   629150468791671b5fde21363e643e87c5815b17
commit: 4dce243b94ed0bd2bacafdf89747dcda9fbdb915 [887/1697] usb: xhci: Add workaround for fixing ep stream ring hang issue
config: h8300-randconfig-p002-20210112 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/Xilinx/linux-xlnx/commit/4dce243b94ed0bd2bacafdf89747dcda9fbdb915
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx xlnx_rebase_v5.4
        git checkout 4dce243b94ed0bd2bacafdf89747dcda9fbdb915
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/h8300/include/asm/bug.h:8,
                    from include/linux/bug.h:5,
                    from include/linux/scatterlist.h:7,
                    from drivers/usb/host/xhci-ring.c:55:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
   include/asm-generic/page.h:91:32: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
      91 | #define pfn_valid(pfn)  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |                                ^~
   include/asm-generic/bug.h:182:25: note: in definition of macro 'WARN_ON'
     182 |  int __ret_warn_on = !!(condition);    \
         |                         ^~~~~~~~~
   include/linux/dma-mapping.h:355:6: note: in expansion of macro 'WARN_ON_ONCE'
     355 |  if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
         |      ^~~~~~~~~~~~
   include/linux/dma-mapping.h:355:19: note: in expansion of macro 'pfn_valid'
     355 |  if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
         |                   ^~~~~~~~~
   drivers/usb/host/xhci-ring.c: In function 'xhci_stream_timeout':
>> drivers/usb/host/xhci-ring.c:957:34: warning: variable 'stream_id' set but not used [-Wunused-but-set-variable]
     957 |  unsigned int slot_id, ep_index, stream_id;
         |                                  ^~~~~~~~~


vim +/stream_id +957 drivers/usb/host/xhci-ring.c

   943	
   944	/* This function is called when the stream ring timer gets timedout.
   945	 * dwc3 host controller has an issue where it doesn't process the BULK IN
   946	 * stream ring TD's(once in a while) even after ringing DoorBell for that
   947	 * stream ring. Because of this behaviour there will be no transfer events
   948	 * generated by the controller on the stream ring, resulting in the hang
   949	 * condition. xhci_stream_timeout() solves this issue by sending a stop
   950	 * command on the stream ring after stream timer gets timedout.
   951	 */
   952	void xhci_stream_timeout(struct timer_list *arg)
   953	{
   954		struct xhci_hcd *xhci;
   955		struct xhci_virt_ep *ep;
   956		struct xhci_ring *ep_ring;
 > 957		unsigned int slot_id, ep_index, stream_id;
   958		struct xhci_td *td = NULL;
   959		struct urb *urb = NULL;
   960		struct urb_priv *urb_priv;
   961		struct xhci_command *command;
   962		unsigned long flags;
   963		int i;
   964	
   965		ep_ring = from_timer(ep_ring, arg, stream_timer);
   966		xhci = ep_ring->xhci;
   967	
   968		spin_lock_irqsave(&xhci->lock, flags);
   969	
   970		if (!list_empty(&ep_ring->td_list)) {
   971			td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list);
   972			urb = td->urb;
   973			urb_priv = urb->hcpriv;
   974	
   975			slot_id = urb->dev->slot_id;
   976			ep_index = xhci_get_endpoint_index(&urb->ep->desc);
   977			stream_id = ep_ring->stream_id;
   978			ep = &xhci->devs[slot_id]->eps[ep_index];
   979			ep_ring->stream_timeout_handler = true;
   980	
   981			/* Delete the stream ring timer */
   982			del_timer(&ep_ring->stream_timer);
   983	
   984			for (i = 0; i < urb_priv->num_tds; i++) {
   985				td = &urb_priv->td[i];
   986				list_add_tail(&td->cancelled_td_list,
   987						&ep->cancelled_td_list);
   988			}
   989	
   990			/* Queue a stop endpoint command, but only if this is
   991			 * the first cancellation to be handled.
   992			 */
   993			if (!(ep->ep_state & EP_STOP_CMD_PENDING)) {
   994				command = xhci_alloc_command(xhci, false,
   995						GFP_ATOMIC);
   996				if (!command) {
   997					xhci_warn(xhci,
   998						"%s: Failed to allocate command\n",
   999							__func__);
  1000					spin_unlock_irqrestore(&xhci->lock, flags);
  1001					return;
  1002				}
  1003	
  1004				ep->ep_state |= EP_STOP_CMD_PENDING;
  1005				ep->stop_cmd_timer.expires = jiffies +
  1006					XHCI_STOP_EP_CMD_TIMEOUT * HZ;
  1007				add_timer(&ep->stop_cmd_timer);
  1008				xhci_queue_stop_endpoint(xhci, command,
  1009						urb->dev->slot_id, ep_index, 0);
  1010				xhci_ring_cmd_db(xhci);
  1011			}
  1012	
  1013			spin_unlock_irqrestore(&xhci->lock, flags);
  1014			return;
  1015		}
  1016	
  1017		spin_unlock_irqrestore(&xhci->lock, flags);
  1018		/* let the SCSI stack take care */
  1019		del_timer(&ep_ring->stream_timer);
  1020	}
  1021	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29948 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210113/c6a02b4c/attachment-0001.gz>


More information about the linux-arm-kernel mailing list