Re: [PATCH 1/3] usb: gadget: function: 9pfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 052d534373b7ed33712a63d5e17b2b6cdbce84fd]

url:    https://github.com/intel-lab-lkp/linux/commits/Michael-Grzeschik/usb-gadget-function-9pfs/20240116-095914
base:   052d534373b7ed33712a63d5e17b2b6cdbce84fd
patch link:    https://lore.kernel.org/r/20240116-ml-topic-u9p-v1-1-ad8c306f9a4e%40pengutronix.de
patch subject: [PATCH 1/3] usb: gadget: function: 9pfs
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20240116/202401161948.no61pNtO-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240116/202401161948.no61pNtO-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401161948.no61pNtO-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/f_9pfs.c:21:
   drivers/usb/gadget/function/f_9pfs.c: In function 'usb9pfs_rx_header':
>> drivers/usb/gadget/function/f_9pfs.c:196:34: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     196 |         p9_debug(P9_DEBUG_TRANS, "mux %p got %u bytes\n", usb9pfs,
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~
     197 |                  rc.capacity - rc.offset);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~
         |                              |
         |                              size_t {aka long unsigned int}
   include/net/9p/9p.h:55:36: note: in definition of macro 'p9_debug'
      55 |         _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
         |                                    ^~~
   drivers/usb/gadget/function/f_9pfs.c:196:47: note: format string is defined here
     196 |         p9_debug(P9_DEBUG_TRANS, "mux %p got %u bytes\n", usb9pfs,
         |                                              ~^
         |                                               |
         |                                               unsigned int
         |                                              %lu
   drivers/usb/gadget/function/f_9pfs.c: At top level:
>> drivers/usb/gadget/function/f_9pfs.c:286:6: warning: no previous prototype for 'disable_endpoints' [-Wmissing-prototypes]
     286 | void disable_endpoints(struct usb_composite_dev *cdev,
         |      ^~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_9pfs.c:825:12: warning: no previous prototype for 'usb9pfs_modinit' [-Wmissing-prototypes]
     825 | int __init usb9pfs_modinit(void)
         |            ^~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_9pfs.c:838:13: warning: no previous prototype for 'usb9pfs_modexit' [-Wmissing-prototypes]
     838 | void __exit usb9pfs_modexit(void)
         |             ^~~~~~~~~~~~~~~


vim +196 drivers/usb/gadget/function/f_9pfs.c

   184	
   185	static struct p9_req_t *usb9pfs_rx_header(struct f_usb9pfs *usb9pfs, struct usb_request *req)
   186	{
   187		struct p9_req_t *p9_rx_req;
   188		struct p9_fcall	rc;
   189		int ret;
   190	
   191		/* start by reading header */
   192		rc.sdata = req->buf;
   193		rc.offset = 0;
   194		rc.capacity = rc.size = P9_HDRSZ;
   195	
 > 196		p9_debug(P9_DEBUG_TRANS, "mux %p got %u bytes\n", usb9pfs,
   197			 rc.capacity - rc.offset);
   198	
   199		ret = p9_parse_header(&rc, &rc.size, NULL, NULL, 0);
   200		if (ret) {
   201			p9_debug(P9_DEBUG_ERROR,
   202				 "error parsing header: %d\n", ret);
   203			return NULL;
   204		}
   205	
   206		p9_debug(P9_DEBUG_TRANS,
   207			 "mux %p pkt: size: %d bytes tag: %d\n",
   208			 usb9pfs, rc.size, rc.tag);
   209	
   210		p9_rx_req = p9_tag_lookup(usb9pfs->client, rc.tag);
   211		if (!p9_rx_req || (p9_rx_req->status != REQ_STATUS_SENT)) {
   212			p9_debug(P9_DEBUG_ERROR, "Unexpected packet tag %d\n", rc.tag);
   213			return NULL;
   214		}
   215	
   216		if (rc.size > p9_rx_req->rc.capacity) {
   217			p9_debug(P9_DEBUG_ERROR,
   218				 "requested packet size too big: %d for tag %d with capacity %zd\n",
   219				 rc.size, rc.tag, p9_rx_req->rc.capacity);
   220			return NULL;
   221		}
   222	
   223		if (!p9_rx_req->rc.sdata) {
   224			p9_debug(P9_DEBUG_ERROR,
   225				 "No recv fcall for tag %d (req %p), disconnecting!\n",
   226				 rc.tag, p9_rx_req);
   227			p9_req_put(usb9pfs->client, p9_rx_req);
   228			return NULL;
   229		}
   230	
   231		return p9_rx_req;
   232	}
   233	
   234	static void usb9pfs_rx_complete(struct usb_ep *ep, struct usb_request *req)
   235	{
   236		struct f_usb9pfs *usb9pfs = ep->driver_data;
   237		struct usb_composite_dev *cdev = usb9pfs->function.config->cdev;
   238		struct p9_req_t *p9_rx_req;
   239		unsigned long flags;
   240	
   241		switch (req->status) {
   242		case 0:				/* normal completion? */
   243			spin_lock_irqsave(&usb9pfs->req_lock, flags);
   244			p9_rx_req = usb9pfs_rx_header(usb9pfs, req);
   245			if (!p9_rx_req) {
   246				spin_unlock_irqrestore(&usb9pfs->req_lock, flags);
   247				goto free_req;
   248			}
   249	
   250			memcpy(p9_rx_req->rc.sdata, req->buf, req->actual);
   251			p9_rx_req->rc.size = req->actual;
   252	
   253			p9_client_cb(usb9pfs->client, p9_rx_req, REQ_STATUS_RCVD);
   254			p9_req_put(usb9pfs->client, p9_rx_req);
   255	
   256			usb9pfs->p9_tx_req = NULL;
   257	
   258			usb9pfs_transmit(usb9pfs);
   259	
   260			spin_unlock_irqrestore(&usb9pfs->req_lock, flags);
   261	
   262			return;
   263	free_req:
   264		default:
   265			dev_err(&cdev->gadget->dev, "%s usb9pfs complete --> %d, %d/%d\n",
   266				ep->name, req->status, req->actual, req->length);
   267			usb_ep_free_request(ep == usb9pfs->in_ep ?
   268					    usb9pfs->out_ep : usb9pfs->in_ep,
   269					    req->context);
   270			free_ep_req(ep, req);
   271			return;
   272		}
   273	
   274		p9_client_cb(usb9pfs->client, p9_rx_req, REQ_STATUS_ERROR);
   275	}
   276	
   277	static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep)
   278	{
   279		int value;
   280	
   281		value = usb_ep_disable(ep);
   282		if (value < 0)
   283			dev_info(&cdev->gadget->dev, "disable %s --> %d\n", ep->name, value);
   284	}
   285	
 > 286	void disable_endpoints(struct usb_composite_dev *cdev,
   287			struct usb_ep *in, struct usb_ep *out,
   288			struct usb_ep *iso_in, struct usb_ep *iso_out)
   289	{
   290		disable_ep(cdev, in);
   291		disable_ep(cdev, out);
   292	}
   293	

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux