drivers/usb/host/fhci-hcd.c:398:8: warning: this statement may fall through

From: kbuild test robot
Date: Wed Feb 12 2020 - 10:13:45 EST


Hi Rasmus,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 359c92c02bfae1a6f1e8e37c298e518fd256642c
commit: 5a35435ef4e6e4bd2aabd6706b146b298a9cffe5 soc: fsl: qe: remove PPC32 dependency from CONFIG_QUICC_ENGINE
date: 9 weeks ago
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5a35435ef4e6e4bd2aabd6706b146b298a9cffe5
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/usb/host/fhci-hcd.c: In function 'fhci_urb_enqueue':
>> drivers/usb/host/fhci-hcd.c:398:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
size = 2;
~~~~~^~~
drivers/usb/host/fhci-hcd.c:399:2: note: here
case PIPE_BULK:
^~~~

vim +398 drivers/usb/host/fhci-hcd.c

236dd4d18f293e Anton Vorontsov 2009-01-10 383
236dd4d18f293e Anton Vorontsov 2009-01-10 384 static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
236dd4d18f293e Anton Vorontsov 2009-01-10 385 gfp_t mem_flags)
236dd4d18f293e Anton Vorontsov 2009-01-10 386 {
236dd4d18f293e Anton Vorontsov 2009-01-10 387 struct fhci_hcd *fhci = hcd_to_fhci(hcd);
236dd4d18f293e Anton Vorontsov 2009-01-10 388 u32 pipe = urb->pipe;
236dd4d18f293e Anton Vorontsov 2009-01-10 389 int ret;
236dd4d18f293e Anton Vorontsov 2009-01-10 390 int i;
236dd4d18f293e Anton Vorontsov 2009-01-10 391 int size = 0;
236dd4d18f293e Anton Vorontsov 2009-01-10 392 struct urb_priv *urb_priv;
236dd4d18f293e Anton Vorontsov 2009-01-10 393 unsigned long flags;
236dd4d18f293e Anton Vorontsov 2009-01-10 394
236dd4d18f293e Anton Vorontsov 2009-01-10 395 switch (usb_pipetype(pipe)) {
236dd4d18f293e Anton Vorontsov 2009-01-10 396 case PIPE_CONTROL:
236dd4d18f293e Anton Vorontsov 2009-01-10 397 /* 1 td fro setup,1 for ack */
236dd4d18f293e Anton Vorontsov 2009-01-10 @398 size = 2;
236dd4d18f293e Anton Vorontsov 2009-01-10 399 case PIPE_BULK:
236dd4d18f293e Anton Vorontsov 2009-01-10 400 /* one td for every 4096 bytes(can be up to 8k) */
236dd4d18f293e Anton Vorontsov 2009-01-10 401 size += urb->transfer_buffer_length / 4096;
236dd4d18f293e Anton Vorontsov 2009-01-10 402 /* ...add for any remaining bytes... */
236dd4d18f293e Anton Vorontsov 2009-01-10 403 if ((urb->transfer_buffer_length % 4096) != 0)
236dd4d18f293e Anton Vorontsov 2009-01-10 404 size++;
236dd4d18f293e Anton Vorontsov 2009-01-10 405 /* ..and maybe a zero length packet to wrap it up */
236dd4d18f293e Anton Vorontsov 2009-01-10 406 if (size == 0)
236dd4d18f293e Anton Vorontsov 2009-01-10 407 size++;
236dd4d18f293e Anton Vorontsov 2009-01-10 408 else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
236dd4d18f293e Anton Vorontsov 2009-01-10 409 && (urb->transfer_buffer_length
236dd4d18f293e Anton Vorontsov 2009-01-10 410 % usb_maxpacket(urb->dev, pipe,
236dd4d18f293e Anton Vorontsov 2009-01-10 411 usb_pipeout(pipe))) != 0)
236dd4d18f293e Anton Vorontsov 2009-01-10 412 size++;
236dd4d18f293e Anton Vorontsov 2009-01-10 413 break;
236dd4d18f293e Anton Vorontsov 2009-01-10 414 case PIPE_ISOCHRONOUS:
236dd4d18f293e Anton Vorontsov 2009-01-10 415 size = urb->number_of_packets;
236dd4d18f293e Anton Vorontsov 2009-01-10 416 if (size <= 0)
236dd4d18f293e Anton Vorontsov 2009-01-10 417 return -EINVAL;
236dd4d18f293e Anton Vorontsov 2009-01-10 418 for (i = 0; i < urb->number_of_packets; i++) {
236dd4d18f293e Anton Vorontsov 2009-01-10 419 urb->iso_frame_desc[i].actual_length = 0;
236dd4d18f293e Anton Vorontsov 2009-01-10 420 urb->iso_frame_desc[i].status = (u32) (-EXDEV);
236dd4d18f293e Anton Vorontsov 2009-01-10 421 }
236dd4d18f293e Anton Vorontsov 2009-01-10 422 break;
236dd4d18f293e Anton Vorontsov 2009-01-10 423 case PIPE_INTERRUPT:
236dd4d18f293e Anton Vorontsov 2009-01-10 424 size = 1;
236dd4d18f293e Anton Vorontsov 2009-01-10 425 }
236dd4d18f293e Anton Vorontsov 2009-01-10 426
236dd4d18f293e Anton Vorontsov 2009-01-10 427 /* allocate the private part of the URB */
236dd4d18f293e Anton Vorontsov 2009-01-10 428 urb_priv = kzalloc(sizeof(*urb_priv), mem_flags);
236dd4d18f293e Anton Vorontsov 2009-01-10 429 if (!urb_priv)
236dd4d18f293e Anton Vorontsov 2009-01-10 430 return -ENOMEM;
236dd4d18f293e Anton Vorontsov 2009-01-10 431
236dd4d18f293e Anton Vorontsov 2009-01-10 432 /* allocate the private part of the URB */
4585ef11d23aa9 Julia Lawall 2009-12-30 433 urb_priv->tds = kcalloc(size, sizeof(*urb_priv->tds), mem_flags);
236dd4d18f293e Anton Vorontsov 2009-01-10 434 if (!urb_priv->tds) {
236dd4d18f293e Anton Vorontsov 2009-01-10 435 kfree(urb_priv);
236dd4d18f293e Anton Vorontsov 2009-01-10 436 return -ENOMEM;
236dd4d18f293e Anton Vorontsov 2009-01-10 437 }
236dd4d18f293e Anton Vorontsov 2009-01-10 438
236dd4d18f293e Anton Vorontsov 2009-01-10 439 spin_lock_irqsave(&fhci->lock, flags);
236dd4d18f293e Anton Vorontsov 2009-01-10 440
236dd4d18f293e Anton Vorontsov 2009-01-10 441 ret = usb_hcd_link_urb_to_ep(hcd, urb);
236dd4d18f293e Anton Vorontsov 2009-01-10 442 if (ret)
236dd4d18f293e Anton Vorontsov 2009-01-10 443 goto err;
236dd4d18f293e Anton Vorontsov 2009-01-10 444
236dd4d18f293e Anton Vorontsov 2009-01-10 445 /* fill the private part of the URB */
236dd4d18f293e Anton Vorontsov 2009-01-10 446 urb_priv->num_of_tds = size;
236dd4d18f293e Anton Vorontsov 2009-01-10 447
236dd4d18f293e Anton Vorontsov 2009-01-10 448 urb->status = -EINPROGRESS;
236dd4d18f293e Anton Vorontsov 2009-01-10 449 urb->actual_length = 0;
236dd4d18f293e Anton Vorontsov 2009-01-10 450 urb->error_count = 0;
236dd4d18f293e Anton Vorontsov 2009-01-10 451 urb->hcpriv = urb_priv;
236dd4d18f293e Anton Vorontsov 2009-01-10 452
236dd4d18f293e Anton Vorontsov 2009-01-10 453 fhci_queue_urb(fhci, urb);
236dd4d18f293e Anton Vorontsov 2009-01-10 454 err:
236dd4d18f293e Anton Vorontsov 2009-01-10 455 if (ret) {
236dd4d18f293e Anton Vorontsov 2009-01-10 456 kfree(urb_priv->tds);
236dd4d18f293e Anton Vorontsov 2009-01-10 457 kfree(urb_priv);
236dd4d18f293e Anton Vorontsov 2009-01-10 458 }
236dd4d18f293e Anton Vorontsov 2009-01-10 459 spin_unlock_irqrestore(&fhci->lock, flags);
236dd4d18f293e Anton Vorontsov 2009-01-10 460 return ret;
236dd4d18f293e Anton Vorontsov 2009-01-10 461 }
236dd4d18f293e Anton Vorontsov 2009-01-10 462

:::::: The code at line 398 was first introduced by commit
:::::: 236dd4d18f293e3c9798f35c08272196826a980d USB: Driver for Freescale QUICC Engine USB Host Controller

:::::: TO: Anton Vorontsov <avorontsov@xxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip