[xlnx:xlnx_rebase_v5.10 1042/1743] drivers/usb/gadget/function/f_tcm.c:342:12: warning: address of array 'fu->cmd' will always evaluate to 'true'

kernel test robot lkp at intel.com
Sat May 29 07:06:30 PDT 2021


Hi Vishal,

First bad commit (maybe != root cause):

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.10
head:   32f0752ed2f4eec60129b62f937c0ad6264a2582
commit: 87134cbd0bfd3a28abc5747ce98d0c2098bdda1a [1042/1743] staging: xlnxsync: Fix the uapi header license
config: powerpc-randconfig-r006-20210529 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bc6799f2f79f0ae87e9f1ebf9d25ba799fbd25a9)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/Xilinx/linux-xlnx/commit/87134cbd0bfd3a28abc5747ce98d0c2098bdda1a
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx xlnx_rebase_v5.10
        git checkout 87134cbd0bfd3a28abc5747ce98d0c2098bdda1a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/f_tcm.c:9:
   In file included from include/linux/kernel.h:12:
   In file included from include/linux/bitops.h:29:
   In file included from arch/powerpc/include/asm/bitops.h:62:
   arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
   #define __lwsync()      __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
           ^
   <built-in>:310:9: note: previous definition is here
   #define __lwsync __builtin_ppc_lwsync
           ^
>> drivers/usb/gadget/function/f_tcm.c:342:12: warning: address of array 'fu->cmd' will always evaluate to 'true' [-Wpointer-bool-conversion]
                   if (!fu->cmd)
                       ~~~~~^~~
   drivers/usb/gadget/function/f_tcm.c:2262:12: error: redefinition of 'tcm_get_alt'
   static int tcm_get_alt(struct usb_function *f, unsigned int intf)
              ^
   drivers/usb/gadget/function/f_tcm.c:2233:12: note: previous definition is here
   static int tcm_get_alt(struct usb_function *f, unsigned intf)
              ^
   2 warnings and 1 error generated.


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

bb44cc88602935 Rajnikant Bhojani 2020-01-23  331  
bb44cc88602935 Rajnikant Bhojani 2020-01-23  332  static int alloc_cmd_resource(struct f_uas *fu, int num, struct usb_ep *ep,
bb44cc88602935 Rajnikant Bhojani 2020-01-23  333  			      void  (*complete)(struct usb_ep *ep,
bb44cc88602935 Rajnikant Bhojani 2020-01-23  334  						struct usb_request *req))
bb44cc88602935 Rajnikant Bhojani 2020-01-23  335  {
bb44cc88602935 Rajnikant Bhojani 2020-01-23  336  	int i;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  337  
bb44cc88602935 Rajnikant Bhojani 2020-01-23  338  	fu->ncmd = num;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  339  	for (i = 0; i < fu->ncmd; i++) {
bb44cc88602935 Rajnikant Bhojani 2020-01-23  340  		fu->cmd[i] = kcalloc(fu->ncmd, sizeof(struct usbg_cdb),
bb44cc88602935 Rajnikant Bhojani 2020-01-23  341  				GFP_KERNEL);
bb44cc88602935 Rajnikant Bhojani 2020-01-23 @342  		if (!fu->cmd)
bb44cc88602935 Rajnikant Bhojani 2020-01-23  343  			goto err_cmd;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  344  
bb44cc88602935 Rajnikant Bhojani 2020-01-23  345  		fu->cmd[i]->req = usb_ep_alloc_request(ep, GFP_KERNEL);
bb44cc88602935 Rajnikant Bhojani 2020-01-23  346  		if (!fu->cmd[i]->req)
bb44cc88602935 Rajnikant Bhojani 2020-01-23  347  			goto err_cmd;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  348  
bb44cc88602935 Rajnikant Bhojani 2020-01-23  349  		fu->cmd[i]->buf = kmalloc(fu->ep_out->maxpacket, GFP_KERNEL);
bb44cc88602935 Rajnikant Bhojani 2020-01-23  350  		if (!fu->cmd[i]->buf)
bb44cc88602935 Rajnikant Bhojani 2020-01-23  351  			goto err_cmd;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  352  
bb44cc88602935 Rajnikant Bhojani 2020-01-23  353  		fu->cmd[i]->req->complete = complete;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  354  		fu->cmd[i]->req->buf = fu->cmd[i]->buf;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  355  		fu->cmd[i]->req->length = fu->ep_out->maxpacket;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  356  		fu->cmd[i]->req->context = fu;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  357  	}
bb44cc88602935 Rajnikant Bhojani 2020-01-23  358  
bb44cc88602935 Rajnikant Bhojani 2020-01-23  359  	return 0;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  360  err_cmd:
bb44cc88602935 Rajnikant Bhojani 2020-01-23  361  	free_cmd_resource(fu, ep);
bb44cc88602935 Rajnikant Bhojani 2020-01-23  362  	return -ENOMEM;
bb44cc88602935 Rajnikant Bhojani 2020-01-23  363  }
bb44cc88602935 Rajnikant Bhojani 2020-01-23  364  

:::::: The code at line 342 was first introduced by commit
:::::: bb44cc886029351e2ae2d1a6eb48e5aa0bd6ff3a usb: gadget: f_tcm: queue multiple commands request

:::::: TO: Rajnikant Bhojani <rajnikant.bhojani at xilinx.com>
:::::: CC: Michal Simek <michal.simek at xilinx.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 28644 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210529/c020696f/attachment-0001.gz>


More information about the linux-arm-kernel mailing list