Linux USB
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Oliver Neukum <oneukum@suse.com>,
	hanguidong02@gmail.com, linux-usb@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Oliver Neukum <oneukum@suse.com>
Subject: Re: [RFT] usb: class: cdc-wdm: switch to kfifo for buffering
Date: Mon, 4 May 2026 23:54:22 +0800	[thread overview]
Message-ID: <202605042331.sI8rgflD-lkp@intel.com> (raw)
In-Reply-To: <20260430121859.1018894-1-oneukum@suse.com>

Hi Oliver,

kernel test robot noticed the following build warnings:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus westeri-thunderbolt/next linus/master v7.1-rc2 next-20260430]
[cannot apply to peter-chen-usb/for-usb-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Oliver-Neukum/usb-class-cdc-wdm-switch-to-kfifo-for-buffering/20260504-164851
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20260430121859.1018894-1-oneukum%40suse.com
patch subject: [RFT] usb: class: cdc-wdm: switch to kfifo for buffering
config: arm-randconfig-004-20260504 (https://download.01.org/0day-ci/archive/20260504/202605042331.sI8rgflD-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260504/202605042331.sI8rgflD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605042331.sI8rgflD-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/usb/class/cdc-wdm.c:526:6: warning: variable 'i' set but not used [-Wunused-but-set-variable]
     526 |         int i = 0;
         |             ^
   1 warning generated.


vim +/i +526 drivers/usb/class/cdc-wdm.c

8dd5cd5395b9007 Bjørn Mork          2013-12-20  521  
afba937e540c902 Oliver Neukum       2008-05-13  522  static ssize_t wdm_read
afba937e540c902 Oliver Neukum       2008-05-13  523  (struct file *file, char __user *buffer, size_t count, loff_t *ppos)
afba937e540c902 Oliver Neukum       2008-05-13  524  {
055e352971719f8 Oliver Neukum       2026-04-30  525  	int rv, cntr, done;
afba937e540c902 Oliver Neukum       2008-05-13 @526  	int i = 0;
afba937e540c902 Oliver Neukum       2008-05-13  527  	struct wdm_device *desc = file->private_data;
afba937e540c902 Oliver Neukum       2008-05-13  528  
afba937e540c902 Oliver Neukum       2008-05-13  529  
e8537bd2c4f325a Bjørn Mork          2012-01-16  530  	rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */
afba937e540c902 Oliver Neukum       2008-05-13  531  	if (rv < 0)
afba937e540c902 Oliver Neukum       2008-05-13  532  		return -ERESTARTSYS;
afba937e540c902 Oliver Neukum       2008-05-13  533  
055e352971719f8 Oliver Neukum       2026-04-30  534  	cntr = kfifo_len(&desc->ubuf);
711c68b3c0f7a92 Ben Hutchings       2012-02-12  535  	if (cntr == 0) {
afba937e540c902 Oliver Neukum       2008-05-13  536  		desc->read = 0;
afba937e540c902 Oliver Neukum       2008-05-13  537  retry:
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  538  		if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  539  			rv = -ENODEV;
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  540  			goto err;
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  541  		}
c0f5ecee4e74166 Oliver Neukum       2013-03-12  542  		if (test_bit(WDM_OVERFLOW, &desc->flags)) {
c0f5ecee4e74166 Oliver Neukum       2013-03-12  543  			clear_bit(WDM_OVERFLOW, &desc->flags);
c0f5ecee4e74166 Oliver Neukum       2013-03-12  544  			rv = -ENOBUFS;
c0f5ecee4e74166 Oliver Neukum       2013-03-12  545  			goto err;
c0f5ecee4e74166 Oliver Neukum       2013-03-12  546  		}
afba937e540c902 Oliver Neukum       2008-05-13  547  		i++;
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  548  		if (file->f_flags & O_NONBLOCK) {
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  549  			if (!test_bit(WDM_READ, &desc->flags)) {
53b7f7b53d83727 Gustavo A. R. Silva 2017-02-14  550  				rv = -EAGAIN;
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  551  				goto err;
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  552  			}
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  553  			rv = 0;
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  554  		} else {
afba937e540c902 Oliver Neukum       2008-05-13  555  			rv = wait_event_interruptible(desc->wait,
afba937e540c902 Oliver Neukum       2008-05-13  556  				test_bit(WDM_READ, &desc->flags));
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  557  		}
afba937e540c902 Oliver Neukum       2008-05-13  558  
7f1dc313d01f5f0 Oliver Neukum       2009-09-09  559  		/* may have happened while we slept */
17d80d562fd78a0 Oliver Neukum       2008-06-24  560  		if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
17d80d562fd78a0 Oliver Neukum       2008-06-24  561  			rv = -ENODEV;
17d80d562fd78a0 Oliver Neukum       2008-06-24  562  			goto err;
17d80d562fd78a0 Oliver Neukum       2008-06-24  563  		}
88044202756925a Bjørn Mork          2012-02-10  564  		if (test_bit(WDM_RESETTING, &desc->flags)) {
88044202756925a Bjørn Mork          2012-02-10  565  			rv = -EIO;
88044202756925a Bjørn Mork          2012-02-10  566  			goto err;
88044202756925a Bjørn Mork          2012-02-10  567  		}
055e352971719f8 Oliver Neukum       2026-04-30  568  		smp_rmb(); /* against wdm_in_callback() */
055e352971719f8 Oliver Neukum       2026-04-30  569  		if (test_bit(WDM_OVERFLOW, &desc->flags)) {
055e352971719f8 Oliver Neukum       2026-04-30  570  			clear_bit(WDM_OVERFLOW, &desc->flags);
055e352971719f8 Oliver Neukum       2026-04-30  571  			rv = -ENOBUFS;
055e352971719f8 Oliver Neukum       2026-04-30  572  			goto err;
055e352971719f8 Oliver Neukum       2026-04-30  573  		}
055e352971719f8 Oliver Neukum       2026-04-30  574  
17d80d562fd78a0 Oliver Neukum       2008-06-24  575  		usb_mark_last_busy(interface_to_usbdev(desc->intf));
afba937e540c902 Oliver Neukum       2008-05-13  576  		if (rv < 0) {
afba937e540c902 Oliver Neukum       2008-05-13  577  			rv = -ERESTARTSYS;
afba937e540c902 Oliver Neukum       2008-05-13  578  			goto err;
afba937e540c902 Oliver Neukum       2008-05-13  579  		}
afba937e540c902 Oliver Neukum       2008-05-13  580  
afba937e540c902 Oliver Neukum       2008-05-13  581  		spin_lock_irq(&desc->iuspin);
afba937e540c902 Oliver Neukum       2008-05-13  582  
afba937e540c902 Oliver Neukum       2008-05-13  583  		if (desc->rerr) { /* read completed, error happened */
85e8a0b9a3565c8 Oliver Neukum       2015-03-23  584  			rv = usb_translate_errors(desc->rerr);
afba937e540c902 Oliver Neukum       2008-05-13  585  			desc->rerr = 0;
afba937e540c902 Oliver Neukum       2008-05-13  586  			spin_unlock_irq(&desc->iuspin);
afba937e540c902 Oliver Neukum       2008-05-13  587  			goto err;
afba937e540c902 Oliver Neukum       2008-05-13  588  		}
afba937e540c902 Oliver Neukum       2008-05-13  589  		/*
afba937e540c902 Oliver Neukum       2008-05-13  590  		 * recheck whether we've lost the race
afba937e540c902 Oliver Neukum       2008-05-13  591  		 * against the completion handler
afba937e540c902 Oliver Neukum       2008-05-13  592  		 */
afba937e540c902 Oliver Neukum       2008-05-13  593  		if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */
afba937e540c902 Oliver Neukum       2008-05-13  594  			spin_unlock_irq(&desc->iuspin);
afba937e540c902 Oliver Neukum       2008-05-13  595  			goto retry;
afba937e540c902 Oliver Neukum       2008-05-13  596  		}
c0f5ecee4e74166 Oliver Neukum       2013-03-12  597  
055e352971719f8 Oliver Neukum       2026-04-30  598  		cntr = kfifo_len(&desc->ubuf);
afba937e540c902 Oliver Neukum       2008-05-13  599  		spin_unlock_irq(&desc->iuspin);
afba937e540c902 Oliver Neukum       2008-05-13  600  	}
afba937e540c902 Oliver Neukum       2008-05-13  601  
711c68b3c0f7a92 Ben Hutchings       2012-02-12  602  	if (cntr > count)
711c68b3c0f7a92 Ben Hutchings       2012-02-12  603  		cntr = count;
055e352971719f8 Oliver Neukum       2026-04-30  604  	rv = kfifo_to_user(&desc->ubuf, buffer, cntr, &done);
055e352971719f8 Oliver Neukum       2026-04-30  605  	if (rv < 0) {
afba937e540c902 Oliver Neukum       2008-05-13  606  		rv = -EFAULT;
afba937e540c902 Oliver Neukum       2008-05-13  607  		goto err;
afba937e540c902 Oliver Neukum       2008-05-13  608  	}
afba937e540c902 Oliver Neukum       2008-05-13  609  
711c68b3c0f7a92 Ben Hutchings       2012-02-12  610  	spin_lock_irq(&desc->iuspin);
711c68b3c0f7a92 Ben Hutchings       2012-02-12  611  
87d65e54b6d5ff6 Oliver Neukum       2008-06-19  612  	/* in case we had outstanding data */
055e352971719f8 Oliver Neukum       2026-04-30  613  	if (kfifo_is_empty(&desc->ubuf)) {
c1da59dad0ebd3f Robert Foss         2016-08-09  614  		clear_bit(WDM_READ, &desc->flags);
c1da59dad0ebd3f Robert Foss         2016-08-09  615  		service_outstanding_interrupt(desc);
c1da59dad0ebd3f Robert Foss         2016-08-09  616  	}
73e06865ead1bec Greg Suarez         2013-10-29  617  	spin_unlock_irq(&desc->iuspin);
055e352971719f8 Oliver Neukum       2026-04-30  618  	rv = done;
afba937e540c902 Oliver Neukum       2008-05-13  619  
afba937e540c902 Oliver Neukum       2008-05-13  620  err:
e8537bd2c4f325a Bjørn Mork          2012-01-16  621  	mutex_unlock(&desc->rlock);
afba937e540c902 Oliver Neukum       2008-05-13  622  	return rv;
afba937e540c902 Oliver Neukum       2008-05-13  623  }
afba937e540c902 Oliver Neukum       2008-05-13  624  

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

  reply	other threads:[~2026-05-04 15:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 12:18 [RFT] usb: class: cdc-wdm: switch to kfifo for buffering Oliver Neukum
2026-05-04 15:54 ` kernel test robot [this message]
2026-05-04 20:37 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202605042331.sI8rgflD-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hanguidong02@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oneukum@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox