drivers/ata/sata_fsl.c:335:6: warning: %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int]

From: kernel test robot
Date: Tue Feb 08 2022 - 00:40:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 555f3d7be91a873114c9656069f1a9fa476ec41a
commit: 87924c5b4094f195507bebcab96e141e48c947d7 ata: sata_fsl: add compile test support
date: 5 weeks ago
compiler: powerpc-linux-gcc (GCC) 11.2.0

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


cppcheck warnings: (new ones prefixed by >>)
>> drivers/ata/sata_fsl.c:335:6: warning: %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int]
if (sscanf(buf, "%d%d",
^
drivers/ata/sata_fsl.c:335:6: warning: %d in format string (no. 2) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int]
if (sscanf(buf, "%d%d",
^
drivers/ata/sata_fsl.c:376:6: warning: %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int]
if (sscanf(buf, "%d", &rx_watermark) != 1) {
^

vim +335 drivers/ata/sata_fsl.c

6b4b8fc87dc5cbf Qiang Liu 2012-02-15 328
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 329 static ssize_t fsl_sata_intr_coalescing_store(struct device *dev,
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 330 struct device_attribute *attr,
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 331 const char *buf, size_t count)
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 332 {
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 333 unsigned int coalescing_count, coalescing_ticks;
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 334
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 @335 if (sscanf(buf, "%d%d",
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 336 &coalescing_count,
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 337 &coalescing_ticks) != 2) {
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 338 printk(KERN_ERR "fsl-sata: wrong parameter format.\n");
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 339 return -EINVAL;
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 340 }
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 341
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 342 fsl_sata_set_irq_coalescing(dev_get_drvdata(dev),
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 343 coalescing_count, coalescing_ticks);
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 344
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 345 return strlen(buf);
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 346 }
6b4b8fc87dc5cbf Qiang Liu 2012-02-15 347

:::::: The code at line 335 was first introduced by commit
:::::: 6b4b8fc87dc5cbfcfb5c749dc200906471fb854c sata_fsl: add support for interrupt coalsecing feature

:::::: TO: Qiang Liu <qiang.liu@xxxxxxxxxxxxx>
:::::: CC: Jeff Garzik <jgarzik@xxxxxxxxxx>

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