[linux-next:master 1981/2764] drivers/staging/hikey9xx/hisi-spmi-controller.c:149:37: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int')

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

 



Hi Mauro,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   494d311a82bb06a81fa7ef4277367701a792e6ef
commit: 1747938a37d1dfa9faa397507f88627158b3d806 [1981/2764] staging: spmi: hisi-spmi-controller: add it to the building system
config: powerpc-randconfig-r003-20200824 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project b587ca93be114d07ec3bf654add97d7872325281)
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
        git checkout 1747938a37d1dfa9faa397507f88627158b3d806
        # 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@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/staging/hikey9xx/hisi-spmi-controller.c:149:37: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                           SPMI_CONTROLLER_MAX_TRANS_BYTES, bc);
                                                            ^~
   include/linux/dev_printk.h:104:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ~~~     ^~~~~~~~~~~
>> drivers/staging/hikey9xx/hisi-spmi-controller.c:199:20: warning: format specifies type 'long' but the argument has type 'unsigned int' [-Wformat]
                           opc, sid, addr, bc + 1);
                                           ^~~~~~
   include/linux/dev_printk.h:104:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ~~~     ^~~~~~~~~~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:221:37: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                           SPMI_CONTROLLER_MAX_TRANS_BYTES, bc);
                                                            ^~
   include/linux/dev_printk.h:104:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ~~~     ^~~~~~~~~~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:271:20: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                           opc, sid, addr, bc);
                                           ^~
   include/linux/dev_printk.h:104:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ~~~     ^~~~~~~~~~~
   4 warnings generated.

# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=1747938a37d1dfa9faa397507f88627158b3d806
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 1747938a37d1dfa9faa397507f88627158b3d806
vim +149 drivers/staging/hikey9xx/hisi-spmi-controller.c

70f59c90c8199e Mayulong              2020-08-17  134  
70f59c90c8199e Mayulong              2020-08-17  135  static int spmi_read_cmd(struct spmi_controller *ctrl,
6af364501949d9 Mauro Carvalho Chehab 2020-08-17  136  			 u8 opc, u8 sid, u16 addr, u8 *__buf, size_t bc)
70f59c90c8199e Mayulong              2020-08-17  137  {
70f59c90c8199e Mayulong              2020-08-17  138  	struct spmi_controller_dev *spmi_controller = dev_get_drvdata(&ctrl->dev);
70f59c90c8199e Mayulong              2020-08-17  139  	unsigned long flags;
6af364501949d9 Mauro Carvalho Chehab 2020-08-17  140  	u8 *buf = __buf;
70f59c90c8199e Mayulong              2020-08-17  141  	u32 cmd, data;
70f59c90c8199e Mayulong              2020-08-17  142  	int rc;
70f59c90c8199e Mayulong              2020-08-17  143  	u32 chnl_ofst = SPMI_CHANNEL_OFFSET * spmi_controller->channel;
70f59c90c8199e Mayulong              2020-08-17  144  	u8 op_code, i;
70f59c90c8199e Mayulong              2020-08-17  145  
70f59c90c8199e Mayulong              2020-08-17  146  	if (bc > SPMI_CONTROLLER_MAX_TRANS_BYTES) {
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  147  		dev_err(&ctrl->dev,
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  148  			"spmi_controller supports 1..%d bytes per trans, but:%ld requested",
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17 @149  			SPMI_CONTROLLER_MAX_TRANS_BYTES, bc);
70f59c90c8199e Mayulong              2020-08-17  150  		return  -EINVAL;
70f59c90c8199e Mayulong              2020-08-17  151  	}
70f59c90c8199e Mayulong              2020-08-17  152  
70f59c90c8199e Mayulong              2020-08-17  153  	/* Check the opcode */
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  154  	if (opc == SPMI_CMD_READ) {
70f59c90c8199e Mayulong              2020-08-17  155  		op_code = SPMI_CMD_REG_READ;
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  156  	} else if (opc == SPMI_CMD_EXT_READ) {
70f59c90c8199e Mayulong              2020-08-17  157  		op_code = SPMI_CMD_EXT_REG_READ;
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  158  	} else if (opc == SPMI_CMD_EXT_READL) {
70f59c90c8199e Mayulong              2020-08-17  159  		op_code = SPMI_CMD_EXT_REG_READ_L;
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  160  	} else {
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  161  		dev_err(&ctrl->dev, "invalid read cmd 0x%x", opc);
70f59c90c8199e Mayulong              2020-08-17  162  		return -EINVAL;
70f59c90c8199e Mayulong              2020-08-17  163  	}
70f59c90c8199e Mayulong              2020-08-17  164  
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  165  	cmd = SPMI_APB_SPMI_CMD_EN |
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  166  	     (op_code << SPMI_APB_SPMI_CMD_TYPE_OFFSET) |
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  167  	     ((bc - 1) << SPMI_APB_SPMI_CMD_LENGTH_OFFSET) |
70f59c90c8199e Mayulong              2020-08-17  168  	     ((sid & 0xf) << SPMI_APB_SPMI_CMD_SLAVEID_OFFSET) |  /* slvid */
70f59c90c8199e Mayulong              2020-08-17  169  	     ((addr & 0xffff)  << SPMI_APB_SPMI_CMD_ADDR_OFFSET); /* slave_addr */
70f59c90c8199e Mayulong              2020-08-17  170  
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  171  	spin_lock_irqsave(&spmi_controller->lock, flags);
70f59c90c8199e Mayulong              2020-08-17  172  
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  173  	writel(cmd, spmi_controller->base + chnl_ofst + SPMI_APB_SPMI_CMD_BASE_ADDR);
70f59c90c8199e Mayulong              2020-08-17  174  
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  175  	rc = spmi_controller_wait_for_done(&ctrl->dev, spmi_controller,
8788a30c12c788 Mauro Carvalho Chehab 2020-08-17  176  					   spmi_controller->base, sid, addr);
70f59c90c8199e Mayulong              2020-08-17  177  	if (rc)
70f59c90c8199e Mayulong              2020-08-17  178  		goto done;
70f59c90c8199e Mayulong              2020-08-17  179  
70f59c90c8199e Mayulong              2020-08-17  180  	i = 0;
70f59c90c8199e Mayulong              2020-08-17  181  	do {
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  182  		data = readl(spmi_controller->base + chnl_ofst + SPMI_SLAVE_OFFSET * sid + SPMI_APB_SPMI_RDATA0_BASE_ADDR + i * SPMI_PER_DATAREG_BYTE);
8788a30c12c788 Mauro Carvalho Chehab 2020-08-17  183  		data = be32_to_cpu((__be32)data);
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  184  		if ((bc - i * SPMI_PER_DATAREG_BYTE) >> 2) {
70f59c90c8199e Mayulong              2020-08-17  185  			memcpy(buf, &data, sizeof(data));
70f59c90c8199e Mayulong              2020-08-17  186  			buf += sizeof(data);
70f59c90c8199e Mayulong              2020-08-17  187  		} else {
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  188  			memcpy(buf, &data, bc % SPMI_PER_DATAREG_BYTE);
70f59c90c8199e Mayulong              2020-08-17  189  			buf += (bc % SPMI_PER_DATAREG_BYTE);
70f59c90c8199e Mayulong              2020-08-17  190  		}
70f59c90c8199e Mayulong              2020-08-17  191  		i++;
70f59c90c8199e Mayulong              2020-08-17  192  	} while (bc > i * SPMI_PER_DATAREG_BYTE);
70f59c90c8199e Mayulong              2020-08-17  193  
70f59c90c8199e Mayulong              2020-08-17  194  done:
70f59c90c8199e Mayulong              2020-08-17  195  	spin_unlock_irqrestore(&spmi_controller->lock, flags);
70f59c90c8199e Mayulong              2020-08-17  196  	if (rc)
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  197  		dev_err(&ctrl->dev,
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  198  			"spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
70f59c90c8199e Mayulong              2020-08-17 @199  			opc, sid, addr, bc + 1);
6af364501949d9 Mauro Carvalho Chehab 2020-08-17  200  	else
4d914a8c480c31 Mauro Carvalho Chehab 2020-08-17  201  		dev_dbg(&ctrl->dev, "%s: id:%d addr:0x%x, read value: %*ph\n",
6af364501949d9 Mauro Carvalho Chehab 2020-08-17  202  			__func__, sid, addr, (int)bc, __buf);
6af364501949d9 Mauro Carvalho Chehab 2020-08-17  203  
70f59c90c8199e Mayulong              2020-08-17  204  	return rc;
2ea3f6a03b155f Mauro Carvalho Chehab 2020-08-17  205  }
70f59c90c8199e Mayulong              2020-08-17  206  

:::::: The code at line 149 was first introduced by commit
:::::: 4d914a8c480c31280505304611030612fa5c2645 staging: spmi: hisi-spmi-controller: fix the dev_foo() logic

:::::: TO: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux