tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4
head:   87d2d58e2137748748d96a630fd93eb0e2d81123
commit: 940136294318baeb0fa1e20b56243cd6a7b9c846 [892/1683] usb: gadget: f_tcm: 
queue multiple commands request
config: x86_64-randconfig-m001-20201029 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/usb/gadget/function/f_tcm.c:342 alloc_cmd_resource() warn: this array 
is probably non-NULL. 'fu->cmd'

vim +342 drivers/usb/gadget/function/f_tcm.c

940136294318bae Rajnikant Bhojani 2020-01-23  332  static int 
alloc_cmd_resource(struct f_uas *fu, int num, struct usb_ep *ep,
940136294318bae Rajnikant Bhojani 2020-01-23  333                             
void  (*complete)(struct usb_ep *ep,
940136294318bae Rajnikant Bhojani 2020-01-23  334                               
                struct usb_request *req))
940136294318bae Rajnikant Bhojani 2020-01-23  335  {
940136294318bae Rajnikant Bhojani 2020-01-23  336       int i;
940136294318bae Rajnikant Bhojani 2020-01-23  337  
940136294318bae Rajnikant Bhojani 2020-01-23  338       fu->ncmd = num;
940136294318bae Rajnikant Bhojani 2020-01-23  339       for (i = 0; i < 
fu->ncmd; i++) {
940136294318bae Rajnikant Bhojani 2020-01-23  340               fu->cmd[i] = 
kcalloc(fu->ncmd, sizeof(struct usbg_cdb),
940136294318bae Rajnikant Bhojani 2020-01-23  341                               
GFP_KERNEL);
940136294318bae Rajnikant Bhojani 2020-01-23 @342               if (!fu->cmd)

This should be "if (!fu->cmd[i])"

940136294318bae Rajnikant Bhojani 2020-01-23  343                       goto 
err_cmd;
940136294318bae Rajnikant Bhojani 2020-01-23  344  
940136294318bae Rajnikant Bhojani 2020-01-23  345               fu->cmd[i]->req 
= usb_ep_alloc_request(ep, GFP_KERNEL);
940136294318bae Rajnikant Bhojani 2020-01-23  346               if 
(!fu->cmd[i]->req)
940136294318bae Rajnikant Bhojani 2020-01-23  347                       goto 
err_cmd;
940136294318bae Rajnikant Bhojani 2020-01-23  348  
940136294318bae Rajnikant Bhojani 2020-01-23  349               fu->cmd[i]->buf 
= kmalloc(fu->ep_out->maxpacket, GFP_KERNEL);
940136294318bae Rajnikant Bhojani 2020-01-23  350               if 
(!fu->cmd[i]->buf)
940136294318bae Rajnikant Bhojani 2020-01-23  351                       goto 
err_cmd;
940136294318bae Rajnikant Bhojani 2020-01-23  352  
940136294318bae Rajnikant Bhojani 2020-01-23  353               
fu->cmd[i]->req->complete = complete;
940136294318bae Rajnikant Bhojani 2020-01-23  354               
fu->cmd[i]->req->buf = fu->cmd[i]->buf;
940136294318bae Rajnikant Bhojani 2020-01-23  355               
fu->cmd[i]->req->length = fu->ep_out->maxpacket;
940136294318bae Rajnikant Bhojani 2020-01-23  356               
fu->cmd[i]->req->context = fu;
940136294318bae Rajnikant Bhojani 2020-01-23  357       }
940136294318bae Rajnikant Bhojani 2020-01-23  358  
940136294318bae Rajnikant Bhojani 2020-01-23  359       return 0;
940136294318bae Rajnikant Bhojani 2020-01-23  360  err_cmd:
940136294318bae Rajnikant Bhojani 2020-01-23  361       free_cmd_resource(fu, 
ep);
940136294318bae Rajnikant Bhojani 2020-01-23  362       return -ENOMEM;
940136294318bae Rajnikant Bhojani 2020-01-23  363  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to