[xilinx-xlnx:xlnx_rebase_v5.15_LTS 336/1129] drivers/usb/host/xhci-ring.c:1266:41: warning: variable 'stream_id' set but not used

kernel test robot lkp at intel.com
Fri May 6 18:26:08 PDT 2022


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   3076249fc30bf463f8390f89009de928ad3e95ff
commit: b93ce7fead6731a072aca8f2c268025f01226cb1 [336/1129] usb: xhci: Add workaround for fixing ep stream ring hang issue
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220507/202205070921.FZZgv96Q-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.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/b93ce7fead6731a072aca8f2c268025f01226cb1
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15_LTS
        git checkout b93ce7fead6731a072aca8f2c268025f01226cb1
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/clk/ drivers/gpu/drm/xlnx/ drivers/media/i2c/ drivers/media/mc/ drivers/media/platform/xilinx/ drivers/misc/ drivers/net/ethernet/xilinx/ drivers/phy/xilinx/ drivers/ptp/ drivers/staging/ drivers/uio/ drivers/usb/host/

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 >>):

   drivers/usb/host/xhci-ring.c: In function 'xhci_stream_timeout':
>> drivers/usb/host/xhci-ring.c:1266:41: warning: variable 'stream_id' set but not used [-Wunused-but-set-variable]
    1266 |         unsigned int slot_id, ep_index, stream_id;
         |                                         ^~~~~~~~~


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

  1252	
  1253	/* This function is called when the stream ring timer gets timedout.
  1254	 * dwc3 host controller has an issue where it doesn't process the BULK IN
  1255	 * stream ring TD's(once in a while) even after ringing DoorBell for that
  1256	 * stream ring. Because of this behaviour there will be no transfer events
  1257	 * generated by the controller on the stream ring, resulting in the hang
  1258	 * condition. xhci_stream_timeout() solves this issue by sending a stop
  1259	 * command on the stream ring after stream timer gets timedout.
  1260	 */
  1261	void xhci_stream_timeout(struct timer_list *arg)
  1262	{
  1263		struct xhci_hcd *xhci;
  1264		struct xhci_virt_ep *ep;
  1265		struct xhci_ring *ep_ring;
> 1266		unsigned int slot_id, ep_index, stream_id;
  1267		struct xhci_td *td = NULL;
  1268		struct urb *urb = NULL;
  1269		struct urb_priv *urb_priv;
  1270		struct xhci_command *command;
  1271		unsigned long flags;
  1272		int i;
  1273	
  1274		ep_ring = from_timer(ep_ring, arg, stream_timer);
  1275		xhci = ep_ring->xhci;
  1276	
  1277		spin_lock_irqsave(&xhci->lock, flags);
  1278	
  1279		if (!list_empty(&ep_ring->td_list)) {
  1280			td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list);
  1281			urb = td->urb;
  1282			urb_priv = urb->hcpriv;
  1283	
  1284			slot_id = urb->dev->slot_id;
  1285			ep_index = xhci_get_endpoint_index(&urb->ep->desc);
  1286			stream_id = ep_ring->stream_id;
  1287			ep = &xhci->devs[slot_id]->eps[ep_index];
  1288			ep_ring->stream_timeout_handler = true;
  1289	
  1290			/* Delete the stream ring timer */
  1291			del_timer(&ep_ring->stream_timer);
  1292	
  1293			for (i = 0; i < urb_priv->num_tds; i++) {
  1294				td = &urb_priv->td[i];
  1295				list_add_tail(&td->cancelled_td_list,
  1296						&ep->cancelled_td_list);
  1297			}
  1298	
  1299			/* Queue a stop endpoint command, but only if this is
  1300			 * the first cancellation to be handled.
  1301			 */
  1302			if (!(ep->ep_state & EP_STOP_CMD_PENDING)) {
  1303				command = xhci_alloc_command(xhci, false,
  1304						GFP_ATOMIC);
  1305				if (!command) {
  1306					xhci_warn(xhci,
  1307						"%s: Failed to allocate command\n",
  1308							__func__);
  1309					spin_unlock_irqrestore(&xhci->lock, flags);
  1310					return;
  1311				}
  1312	
  1313				ep->ep_state |= EP_STOP_CMD_PENDING;
  1314				ep->stop_cmd_timer.expires = jiffies +
  1315					XHCI_STOP_EP_CMD_TIMEOUT * HZ;
  1316				add_timer(&ep->stop_cmd_timer);
  1317				xhci_queue_stop_endpoint(xhci, command,
  1318						urb->dev->slot_id, ep_index, 0);
  1319				xhci_ring_cmd_db(xhci);
  1320			}
  1321	
  1322			spin_unlock_irqrestore(&xhci->lock, flags);
  1323			return;
  1324		}
  1325	
  1326		spin_unlock_irqrestore(&xhci->lock, flags);
  1327		/* let the SCSI stack take care */
  1328		del_timer(&ep_ring->stream_timer);
  1329	}
  1330	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



More information about the linux-arm-kernel mailing list