[mkl-can-next:mcp25xxfd-43 3/4] drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c:334:7: warning: field width specifier expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'}

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git mcp25xxfd-43
head:   18af4701dc2c087ec894932bab08714fc1226e2f
commit: 2bee400d8deb1d6b5a9cddfec7b0460a29c3536f [3/4] can: mcp25xxfd: initial commit
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-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 2bee400d8deb1d6b5a9cddfec7b0460a29c3536f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

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/printk.h:404,
                    from include/linux/kernel.h:15,
                    from include/linux/uio.h:8,
                    from include/linux/socket.h:8,
                    from include/uapi/linux/can.h:50,
                    from include/linux/can/core.h:17,
                    from drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h:13,
                    from drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c:9:
   drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c: In function 'mcp25xxfd_regmap_crc_read':
>> drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c:334:7: warning: field width specifier '*' expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     334 |       "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     335 |       reg, val_len, val_len, buf_rx->data,
         |                     ~~~~~~~
         |                     |
         |                     size_t {aka long unsigned int}
   include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
     125 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt, __dynamic_netdev_dbg,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/netdevice.h:4953:2: note: in expansion of macro 'dynamic_netdev_dbg'
    4953 |  dynamic_netdev_dbg(__dev, format, ##args);  \
         |  ^~~~~~~~~~~~~~~~~~
>> drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c:333:3: note: in expansion of macro 'netdev_dbg'
     333 |   netdev_dbg(priv->ndev,
         |   ^~~~~~~~~~
   drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c:334:60: note: format string is defined here
     334 |       "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
         |                                                           ~^~
         |                                                            |
         |                                                            int
   drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c:341:61: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     341 |        "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
         |                                                            ~^~
         |                                                             |
         |                                                             int
     342 |        reg, val_len, val_len, buf_rx->data,
         |                      ~~~~~~~                                 
         |                      |
         |                      size_t {aka long unsigned int}

vim +334 drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c

   261	
   262	static int
   263	mcp25xxfd_regmap_crc_read(void *context,
   264				  const void *reg_p, size_t reg_len,
   265				  void *val_buf, size_t val_len)
   266	{
   267		struct spi_device *spi = context;
   268		struct mcp25xxfd_priv *priv = spi_get_drvdata(spi);
   269		struct mcp25xxfd_map_buf_crc *buf_rx = priv->map_buf_crc_rx;
   270		struct mcp25xxfd_map_buf_crc *buf_tx = priv->map_buf_crc_tx;
   271		struct spi_transfer xfer[2] = { };
   272		struct spi_message msg;
   273		u16 reg = *(u16 *)reg_p;
   274		int i, err;
   275	
   276		BUILD_BUG_ON(sizeof(buf_rx->cmd) != sizeof(__be16) + sizeof(u8));
   277		BUILD_BUG_ON(sizeof(buf_tx->cmd) != sizeof(__be16) + sizeof(u8));
   278	
   279		if (IS_ENABLED(CONFIG_CAN_MCP25XXFD_SANITY) &&
   280		    reg_len != sizeof(buf_tx->cmd.cmd) +
   281		    mcp25xxfd_regmap_crc.pad_bits / BITS_PER_BYTE)
   282			return -EINVAL;
   283	
   284		spi_message_init(&msg);
   285		spi_message_add_tail(&xfer[0], &msg);
   286	
   287		if (priv->devtype_data.quirks & MCP25XXFD_QUIRK_HALF_DUPLEX) {
   288			xfer[0].tx_buf = buf_tx;
   289			xfer[0].len = sizeof(buf_tx->cmd);
   290	
   291			xfer[1].rx_buf = buf_rx->data;
   292			xfer[1].len = val_len + sizeof(buf_tx->crc);
   293			spi_message_add_tail(&xfer[1], &msg);
   294		} else {
   295			xfer[0].tx_buf = buf_tx;
   296			xfer[0].rx_buf = buf_rx;
   297			xfer[0].len = sizeof(buf_tx->cmd) + val_len +
   298				sizeof(buf_tx->crc);
   299	
   300			if (IS_ENABLED(CONFIG_CAN_MCP25XXFD_SANITY))
   301				memset(buf_tx->data, 0x0, val_len +
   302				       sizeof(buf_tx->crc));
   303		}
   304	
   305		mcp25xxfd_spi_cmd_read_crc(&buf_tx->cmd, reg, val_len);
   306	
   307		for (i = 0; i < MCP25XXFD_READ_CRC_RETRIES_MAX; i++) {
   308			err = mcp25xxfd_regmap_crc_read_one(priv, &msg, val_len);
   309			if (!err)
   310				goto out;
   311			if (err != -EBADMSG)
   312				return err;
   313	
   314			/* MCP25XXFD_REG_OSC is the first ever reg we read from.
   315			 *
   316			 * The chip may be in deep sleep and this SPI transfer
   317			 * (i.e. the assertion of the CS) will wake the chip
   318			 * up. This takes about 3ms. The CRC of this transfer
   319			 * is wrong.
   320			 *
   321			 * Or there isn't a chip at all, in this case the CRC
   322			 * will be wrong, too.
   323			 *
   324			 * In both cases ignore the CRC and copy the read data
   325			 * to the caller. It will take care of both cases.
   326			 *
   327			 */
   328			if (reg == MCP25XXFD_REG_OSC) {
   329				err = 0;
   330				goto out;
   331			}
   332	
 > 333			netdev_dbg(priv->ndev,
 > 334				   "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
   335				   reg, val_len, val_len, buf_rx->data,
   336				   get_unaligned_be16(buf_rx->data + val_len));
   337		}
   338	
   339		if (err) {
   340			netdev_info(priv->ndev,
   341				    "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
   342				    reg, val_len, val_len, buf_rx->data,
   343				    get_unaligned_be16(buf_rx->data + val_len));
   344	
   345			return err;
   346		}
   347	 out:
   348		memcpy(val_buf, buf_rx->data, val_len);
   349	
   350		return 0;
   351	}
   352	

---
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]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux