Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.9-rc4 next-20200910]
[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/Andy-Shevchenko/gpiolib-Fix-line...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: ia64-randconfig-s032-20200909 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> drivers/gpio/gpiolib-cdev.c:432:41: sparse: sparse: expected ; at
end of declaration
drivers/gpio/gpiolib-cdev.c:432:41: sparse: sparse: Expected }
at end of struct-union-enum-specifier
drivers/gpio/gpiolib-cdev.c:432:41: sparse: sparse: got timestamp
drivers/gpio/gpiolib-cdev.c:446:17: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:446:17: sparse: sparse: got &&
> drivers/gpio/gpiolib-cdev.c:446:9: sparse: sparse: Trying to use
reserved word 'if' as identifier
drivers/gpio/gpiolib-cdev.c:449:9:
sparse: sparse: Expected ; at the end of type declaration
drivers/gpio/gpiolib-cdev.c:449:9: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:452:1: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:452:1: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:467:19: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:467:19: sparse: sparse: got <
drivers/gpio/gpiolib-cdev.c:467:9: sparse: sparse: Trying to use reserved word
'if' as identifier
> drivers/gpio/gpiolib-cdev.c:470:9: sparse: sparse: Trying to use
reserved word 'do' as identifier
drivers/gpio/gpiolib-cdev.c:470:12:
sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:470:12: sparse: sparse: got {
drivers/gpio/gpiolib-cdev.c:472:21: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:472:21: sparse: sparse: got (
drivers/gpio/gpiolib-cdev.c:472:17: sparse: sparse: Trying to use reserved word
'if' as identifier
drivers/gpio/gpiolib-cdev.c:472:21: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:472:21: sparse: sparse: got ->
drivers/gpio/gpiolib-cdev.c:472:21: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:472:21: sparse: sparse: got }
> drivers/gpio/gpiolib-cdev.c:475:33: sparse: sparse: Trying to use
reserved word 'return' as identifier
drivers/gpio/gpiolib-cdev.c:475:40:
sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:475:40: sparse: sparse: got bytes_read
drivers/gpio/gpiolib-cdev.c:476:25: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:476:25: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:480:33: sparse: sparse: Trying to use reserved word
'return' as identifier
drivers/gpio/gpiolib-cdev.c:480:40: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:480:40: sparse: sparse: got -
drivers/gpio/gpiolib-cdev.c:481:25: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:481:25: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got ->
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got 0
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'if' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'do' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got {
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'if' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got break
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got ->
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got &
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'do' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got {
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got (
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'if' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in nested declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got {
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got (
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'if' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got
"drivers/gpio/gpiolib-cdev.c"
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'do' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got {
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got !
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ; at the end of type
declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got }
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Expected ) in nested declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got task_struct
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use
reserved word 'struct' as identifier
drivers/gpio/gpiolib-cdev.c:483:31:
sparse: sparse: Expected ) in function declarator
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got 1037
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use
reserved word 'switch' as identifier
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'break' as identifier
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'case' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse:
Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got 1016
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use
reserved word 'break' as identifier
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'case' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse:
Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got 1019
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use
reserved word 'break' as identifier
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'case' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse:
Expected ; at end of declaration
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: got 1037
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use
reserved word 'break' as identifier
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: Trying to use reserved word
'case' as identifier
drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse:
Expected ; at end of declaration
> drivers/gpio/gpiolib-cdev.c:483:31: sparse: sparse: too many
errors
#
https://github.com/0day-ci/linux/commit/402a73d41d7b2b3a72dc346e62d2b4c44...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Andy-Shevchenko/gpiolib-Fix-line-event-handling-in-syscall-compatible-mode/20200910-182240
git checkout 402a73d41d7b2b3a72dc346e62d2b4c4403a6277
vim +432 drivers/gpio/gpiolib-cdev.c
425
426 static ssize_t lineevent_to_user(char __user *buf, struct gpioevent_data *ge)
427 {
428 #ifdef __x86_64__
429 /* i386 has no padding after 'id' */
430 if (in_ia32_syscall()) {
431 struct compat_ge {
432 compat_u64 timestamp __packed;
433 u32 id;
434 } cge;
435
436 if (buf && ge) {
437 cge = (struct compat_ge){ ge->timestamp, ge->id };
438 if (copy_to_user(buf, &cge, sizeof(cge)))
439 return -EFAULT;
440 }
441
442 return sizeof(cge);
443 }
444 #endif
445
446 if (buf && ge) {
447 if (copy_to_user(buf,
ge, sizeof(*ge)))
448 return -EFAULT;
449 }
450
451 return sizeof(*ge);
452 }
453
454 static ssize_t lineevent_read(struct file *file,
455 char __user *buf,
456 size_t count,
457 loff_t *f_ps)
458 {
459 struct lineevent_state *le = file->private_data;
460 struct gpioevent_data ge;
461 ssize_t bytes_read = 0;
462 ssize_t ge_size;
463 int ret;
464
465 /* When argument is NULL it returns size of the structure in user space */
466 ge_size = lineevent_to_user(NULL, NULL);
467 if (count < ge_size)
468 return -EINVAL;
469
470 do {
471 spin_lock(&le->wait.lock);
472 if (kfifo_is_empty(&le->events)) {
473 if (bytes_read) {
474 spin_unlock(&le->wait.lock);
475 return bytes_read;
476 }
477
478 if (file->f_flags & O_NONBLOCK) {
479 spin_unlock(&le->wait.lock);
480 return -EAGAIN;
481 }
482
483 ret = wait_event_interruptible_locked(le->wait,
484 !kfifo_is_empty(&le->events));
485 if (ret) {
486 spin_unlock(&le->wait.lock);
487 return ret;
488 }
489 }
490
491 ret = kfifo_out(&le->events, &ge, 1);
492 spin_unlock(&le->wait.lock);
493 if (ret != 1) {
494 /*
495 * This should never happen - we were holding the lock
496 * from the moment we learned the fifo is no longer
497 * empty until now.
498 */
499 ret = -EIO;
500 break;
501 }
502
503 ret = lineevent_to_user(buf + bytes_read, &ge);
504 if (ret < 0)
505 return ret;
506 bytes_read += ret;
507 } while (count >= bytes_read + ge_size);
508
509 return bytes_read;
510 }
511
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org