[linux-next:master 1732/2666] drivers/staging/hikey9xx/hisi-spmi-controller.c:148:4: warning: format '%ld' expects argument of type 'long int', but argument 4 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:   d8be0e12a522d53a45f85fb241ffd06108d40b03
commit: 1747938a37d1dfa9faa397507f88627158b3d806 [1732/2666] staging: spmi: hisi-spmi-controller: add it to the building system
config: arm-randconfig-r035-20200824 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
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
        git checkout 1747938a37d1dfa9faa397507f88627158b3d806
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/staging/hikey9xx/hisi-spmi-controller.c:7:
   drivers/staging/hikey9xx/hisi-spmi-controller.c: In function 'spmi_read_cmd':
>> drivers/staging/hikey9xx/hisi-spmi-controller.c:148:4: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     148 |    "spmi_controller supports 1..%d bytes per trans, but:%ld requested",
         |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:147:3: note: in expansion of macro 'dev_err'
     147 |   dev_err(&ctrl->dev,
         |   ^~~~~~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:148:59: note: format string is defined here
     148 |    "spmi_controller supports 1..%d bytes per trans, but:%ld requested",
         |                                                         ~~^
         |                                                           |
         |                                                           long int
         |                                                         %d
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/staging/hikey9xx/hisi-spmi-controller.c:7:
   drivers/staging/hikey9xx/hisi-spmi-controller.c:198:4: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     198 |    "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:197:3: note: in expansion of macro 'dev_err'
     197 |   dev_err(&ctrl->dev,
         |   ^~~~~~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:198:58: note: format string is defined here
     198 |    "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                                                        ~~^
         |                                                          |
         |                                                          long int
         |                                                        %d
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/staging/hikey9xx/hisi-spmi-controller.c:7:
   drivers/staging/hikey9xx/hisi-spmi-controller.c: In function 'spmi_write_cmd':
   drivers/staging/hikey9xx/hisi-spmi-controller.c:220:4: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     220 |    "spmi_controller supports 1..%d bytes per trans, but:%ld requested",
         |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:219:3: note: in expansion of macro 'dev_err'
     219 |   dev_err(&ctrl->dev,
         |   ^~~~~~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:220:59: note: format string is defined here
     220 |    "spmi_controller supports 1..%d bytes per trans, but:%ld requested",
         |                                                         ~~^
         |                                                           |
         |                                                           long int
         |                                                         %d
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/staging/hikey9xx/hisi-spmi-controller.c:7:
   drivers/staging/hikey9xx/hisi-spmi-controller.c:270:23: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     270 |   dev_err(&ctrl->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:270:3: note: in expansion of macro 'dev_err'
     270 |   dev_err(&ctrl->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |   ^~~~~~~
   drivers/staging/hikey9xx/hisi-spmi-controller.c:270:78: note: format string is defined here
     270 |   dev_err(&ctrl->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                                                                            ~~^
         |                                                                              |
         |                                                                              long int
         |                                                                            %d

# 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 +148 drivers/staging/hikey9xx/hisi-spmi-controller.c

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

:::::: The code at line 148 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