Re: [PATCH v2 1/3] usb: gadget: ccid: add support for USB CCID Gadget Device

From: kbuild test robot
Date: Mon May 28 2018 - 21:16:11 EST


Hi Marcus,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on balbi-usb/next]
[also build test WARNING on v4.17-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Marcus-Folkesson/usb-gadget-ccid-add-support-for-USB-CCID-Gadget-Device/20180529-014427
base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: s390-allyesconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
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
make.cross ARCH=s390

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:332:0,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/cdev.h:5,
from drivers/usb/gadget/function/f_ccid.c:8:
drivers/usb/gadget/function/f_ccid.c: In function 'ccidg_bulk_read':
>> drivers/usb/gadget/function/f_ccid.c:612:5: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]
"ccid: too small buffer size. %i provided, need at least %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
>> drivers/usb/gadget/function/f_ccid.c:611:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
>> drivers/usb/gadget/function/f_ccid.c:612:5: warning: format '%i' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
"ccid: too small buffer size. %i provided, need at least %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
>> drivers/usb/gadget/function/f_ccid.c:611:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
drivers/usb/gadget/function/f_ccid.c: In function 'ccidg_bulk_write':
drivers/usb/gadget/function/f_ccid.c:683:5: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]
"ccid: too much data. %i provided, but we can only handle %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
drivers/usb/gadget/function/f_ccid.c:682:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
drivers/usb/gadget/function/f_ccid.c:683:5: warning: format '%i' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
"ccid: too much data. %i provided, but we can only handle %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
drivers/usb/gadget/function/f_ccid.c:682:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
--
In file included from include/linux/printk.h:332:0,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/cdev.h:5,
from drivers/usb//gadget/function/f_ccid.c:8:
drivers/usb//gadget/function/f_ccid.c: In function 'ccidg_bulk_read':
drivers/usb//gadget/function/f_ccid.c:612:5: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]
"ccid: too small buffer size. %i provided, need at least %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
drivers/usb//gadget/function/f_ccid.c:611:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
drivers/usb//gadget/function/f_ccid.c:612:5: warning: format '%i' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
"ccid: too small buffer size. %i provided, need at least %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
drivers/usb//gadget/function/f_ccid.c:611:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
drivers/usb//gadget/function/f_ccid.c: In function 'ccidg_bulk_write':
drivers/usb//gadget/function/f_ccid.c:683:5: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]
"ccid: too much data. %i provided, but we can only handle %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
drivers/usb//gadget/function/f_ccid.c:682:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~
drivers/usb//gadget/function/f_ccid.c:683:5: warning: format '%i' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
"ccid: too much data. %i provided, but we can only handle %i\n",
^
include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> include/linux/usb/composite.h:632:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&(d)->gadget->dev , fmt , ## args)
^~~~~~~
drivers/usb//gadget/function/f_ccid.c:682:3: note: in expansion of macro 'DBG'
DBG(ccidg->function.config->cdev,
^~~

vim +612 drivers/usb/gadget/function/f_ccid.c

599
600 static ssize_t ccidg_bulk_read(struct file *file, char __user *buf,
601 size_t count, loff_t *pos)
602 {
603 struct f_ccidg *ccidg = file->private_data;
604 struct ccidg_bulk_dev *bulk_dev = &ccidg->bulk_dev;
605 struct usb_request *req;
606 int r = count, xfer;
607 int ret;
608
609 /* Make sure we have enough space for a whole package */
610 if (count < sizeof(struct ccidg_bulk_out_header)) {
> 611 DBG(ccidg->function.config->cdev,
> 612 "ccid: too small buffer size. %i provided, need at least %i\n",
613 count, sizeof(struct ccidg_bulk_out_header));
614 return -ENOMEM;
615 }
616
617 if (!atomic_read(&ccidg->online))
618 return -ENODEV;
619
620 /* queue a request */
621 req = bulk_dev->rx_req;
622 req->length = count;
623 atomic_set(&bulk_dev->rx_done, 0);
624
625 ret = usb_ep_queue(ccidg->out, req, GFP_KERNEL);
626 if (ret < 0) {
627 ERROR(ccidg->function.config->cdev,
628 "ccid: usb ep queue failed\n");
629 return -EIO;
630 }
631
632 if (!atomic_read(&bulk_dev->rx_done) &&
633 file->f_flags & (O_NONBLOCK | O_NDELAY))
634 return -EAGAIN;
635
636 /* wait for a request to complete */
637 ret = wait_event_interruptible(bulk_dev->read_wq,
638 atomic_read(&bulk_dev->rx_done) ||
639 !atomic_read(&ccidg->online));
640 if (ret < 0) {
641 usb_ep_dequeue(ccidg->out, req);
642 return -ERESTARTSYS;
643 }
644
645 /* Still online? */
646 if (!atomic_read(&ccidg->online))
647 return -ENODEV;
648
649 atomic_set(&bulk_dev->rx_req_busy, 1);
650 xfer = (req->actual < count) ? req->actual : count;
651
652 if (copy_to_user(buf, req->buf, xfer))
653 r = -EFAULT;
654
655 atomic_set(&bulk_dev->rx_req_busy, 0);
656 if (!atomic_read(&ccidg->online)) {
657 ccidg_request_free(bulk_dev->rx_req, ccidg->out);
658 return -ENODEV;
659 }
660
661 return xfer;
662 }
663

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip