Hi Oliver,
I love your patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.9-rc6 next-20200921]
[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]
url:
https://github.com/0day-ci/linux/commits/Oliver-Neukum/chaoskey-O_NONBLOC...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: sh-allmodconfig (attached as .config)
compiler: sh4-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/usb/misc/chaoskey.c: In function 'chaoskey_request_fill':
> drivers/usb/misc/chaoskey.c:340:7: warning: variable
'started' set but not used [-Wunused-but-set-variable]
340 | bool
started;
| ^~~~~~~
#
https://github.com/0day-ci/linux/commit/4393931662d77cd7c609d4cfd82ad5990...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Oliver-Neukum/chaoskey-O_NONBLOCK-in-concurrent-reads/20200921-203804
git checkout 4393931662d77cd7c609d4cfd82ad59900c9b13b
vim +/started +340 drivers/usb/misc/chaoskey.c
0ca10122ca08d2 Oliver Neukum 2016-02-17 335
4393931662d77c Oliver Neukum 2020-09-21 336 static int chaoskey_request_fill(struct
chaoskey *dev)
66e3e591891da9 Keith Packard 2015-03-19 337 {
66e3e591891da9 Keith Packard 2015-03-19 338 DEFINE_WAIT(wait);
66e3e591891da9 Keith Packard 2015-03-19 339 int result;
e4a886e811cd07 Bob Ham 2016-06-03 @340 bool started;
66e3e591891da9 Keith Packard 2015-03-19 341
4393931662d77c Oliver Neukum 2020-09-21 342 usb_dbg(dev->interface, "request
fill");
66e3e591891da9 Keith Packard 2015-03-19 343
66e3e591891da9 Keith Packard 2015-03-19 344 /* Return immediately if someone called
before the buffer was
66e3e591891da9 Keith Packard 2015-03-19 345 * empty */
66e3e591891da9 Keith Packard 2015-03-19 346 if (dev->valid != dev->used) {
66e3e591891da9 Keith Packard 2015-03-19 347 usb_dbg(dev->interface, "not empty
yet (valid %d used %d)",
66e3e591891da9 Keith Packard 2015-03-19 348 dev->valid, dev->used);
66e3e591891da9 Keith Packard 2015-03-19 349 return 0;
66e3e591891da9 Keith Packard 2015-03-19 350 }
66e3e591891da9 Keith Packard 2015-03-19 351
66e3e591891da9 Keith Packard 2015-03-19 352 /* Bail if the device has been removed */
66e3e591891da9 Keith Packard 2015-03-19 353 if (!dev->present) {
66e3e591891da9 Keith Packard 2015-03-19 354 usb_dbg(dev->interface, "device
not present");
66e3e591891da9 Keith Packard 2015-03-19 355 return -ENODEV;
66e3e591891da9 Keith Packard 2015-03-19 356 }
66e3e591891da9 Keith Packard 2015-03-19 357
66e3e591891da9 Keith Packard 2015-03-19 358 /* Make sure the device is awake */
66e3e591891da9 Keith Packard 2015-03-19 359 result =
usb_autopm_get_interface(dev->interface);
66e3e591891da9 Keith Packard 2015-03-19 360 if (result) {
66e3e591891da9 Keith Packard 2015-03-19 361 usb_dbg(dev->interface, "wakeup
failed (result %d)", result);
66e3e591891da9 Keith Packard 2015-03-19 362 return result;
66e3e591891da9 Keith Packard 2015-03-19 363 }
66e3e591891da9 Keith Packard 2015-03-19 364
0ca10122ca08d2 Oliver Neukum 2016-02-17 365 dev->reading = true;
0ca10122ca08d2 Oliver Neukum 2016-02-17 366 result = usb_submit_urb(dev->urb,
GFP_KERNEL);
0ca10122ca08d2 Oliver Neukum 2016-02-17 367 if (result < 0) {
0ca10122ca08d2 Oliver Neukum 2016-02-17 368 result = usb_translate_errors(result);
0ca10122ca08d2 Oliver Neukum 2016-02-17 369 dev->reading = false;
0ca10122ca08d2 Oliver Neukum 2016-02-17 370 goto out;
0ca10122ca08d2 Oliver Neukum 2016-02-17 371 }
0ca10122ca08d2 Oliver Neukum 2016-02-17 372
e4a886e811cd07 Bob Ham 2016-06-03 373 /* The first read on the Alea takes a
little under 2 seconds.
e4a886e811cd07 Bob Ham 2016-06-03 374 * Reads after the first read take only a
few microseconds
e4a886e811cd07 Bob Ham 2016-06-03 375 * though. Presumably the
entropy-generating circuit needs
e4a886e811cd07 Bob Ham 2016-06-03 376 * time to ramp up. So, we wait longer on
the first read.
e4a886e811cd07 Bob Ham 2016-06-03 377 */
e4a886e811cd07 Bob Ham 2016-06-03 378 started = dev->reads_started;
e4a886e811cd07 Bob Ham 2016-06-03 379 dev->reads_started = true;
4393931662d77c Oliver Neukum 2020-09-21 380 /*
4393931662d77c Oliver Neukum 2020-09-21 381 * powering down while a read is under way
4393931662d77c Oliver Neukum 2020-09-21 382 * is blocked in suspend()
4393931662d77c Oliver Neukum 2020-09-21 383 */
4393931662d77c Oliver Neukum 2020-09-21 384
usb_autopm_put_interface(dev->interface);
4393931662d77c Oliver Neukum 2020-09-21 385 return 0;
4393931662d77c Oliver Neukum 2020-09-21 386 out:
4393931662d77c Oliver Neukum 2020-09-21 387
usb_autopm_put_interface(dev->interface);
4393931662d77c Oliver Neukum 2020-09-21 388 return result;
4393931662d77c Oliver Neukum 2020-09-21 389 }
4393931662d77c Oliver Neukum 2020-09-21 390
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org