diff mbox series

Input: add printf attribute to log function

Message ID 20201221160126.3752467-1-trix@redhat.com
State New
Headers show
Series Input: add printf attribute to log function | expand

Commit Message

Tom Rix Dec. 21, 2020, 4:01 p.m. UTC
From: Tom Rix <trix@redhat.com>

Attributing the function allows the compiler to more thoroughly
check the use of the function with -Wformat and similar flags.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/input/rmi4/rmi_bus.h | 1 +
 1 file changed, 1 insertion(+)

Comments

kernel test robot Dec. 23, 2020, 12:43 p.m. UTC | #1
Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on input/next]
[also build test WARNING on hid/for-next linux/master linus/master v5.10 next-20201223]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/trix-redhat-com/Input-add-printf-attribute-to-log-function/20201222-000605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: powerpc-randconfig-r012-20201221 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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/0day-ci/linux/commit/5b08ecef17d4460881812ffd1a1740152fa38e55
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review trix-redhat-com/Input-add-printf-attribute-to-log-function/20201222-000605
        git checkout 5b08ecef17d4460881812ffd1a1740152fa38e55
        # 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@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/input/rmi4/rmi_f34v7.c:362:31: warning: field width should have type 'int', but argument has type 'unsigned long' [-Wformat]

                           "%s: Partition entry %d: %*ph\n",
                                                    ~~^
   drivers/input/rmi4/rmi_f34v7.c:543:68: warning: field width should have type 'int', but argument has type 'unsigned long' [-Wformat]
           rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: Supported partitions: %*ph\n",
                                                                           ~~^
   2 warnings generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV
   Depends on PCI && HOTPLUG_PCI && PPC_POWERNV && EEH
   Selected by
   - OCXL && PPC_POWERNV && PCI && EEH


vim +362 drivers/input/rmi4/rmi_f34v7.c

5191d88acc68874 Nick Dyer 2016-12-10  344  
5191d88acc68874 Nick Dyer 2016-12-10  345  static void rmi_f34v7_parse_partition_table(struct f34_data *f34,
5191d88acc68874 Nick Dyer 2016-12-10  346  					    const void *partition_table,
5191d88acc68874 Nick Dyer 2016-12-10  347  					    struct block_count *blkcount,
5191d88acc68874 Nick Dyer 2016-12-10  348  					    struct physical_address *phyaddr)
5191d88acc68874 Nick Dyer 2016-12-10  349  {
5191d88acc68874 Nick Dyer 2016-12-10  350  	int i;
5191d88acc68874 Nick Dyer 2016-12-10  351  	int index;
5191d88acc68874 Nick Dyer 2016-12-10  352  	u16 partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  353  	u16 physical_address;
5191d88acc68874 Nick Dyer 2016-12-10  354  	const struct partition_table *ptable;
5191d88acc68874 Nick Dyer 2016-12-10  355  
5191d88acc68874 Nick Dyer 2016-12-10  356  	for (i = 0; i < f34->v7.partitions; i++) {
5191d88acc68874 Nick Dyer 2016-12-10  357  		index = i * 8 + 2;
5191d88acc68874 Nick Dyer 2016-12-10  358  		ptable = partition_table + index;
5191d88acc68874 Nick Dyer 2016-12-10  359  		partition_length = le16_to_cpu(ptable->partition_length);
5191d88acc68874 Nick Dyer 2016-12-10  360  		physical_address = le16_to_cpu(ptable->start_physical_address);
5191d88acc68874 Nick Dyer 2016-12-10  361  		rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10 @362  			"%s: Partition entry %d: %*ph\n",
5191d88acc68874 Nick Dyer 2016-12-10  363  			__func__, i, sizeof(struct partition_table), ptable);
5191d88acc68874 Nick Dyer 2016-12-10  364  		switch (ptable->partition_id & 0x1f) {
5191d88acc68874 Nick Dyer 2016-12-10  365  		case CORE_CODE_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  366  			blkcount->ui_firmware = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  367  			phyaddr->ui_firmware = physical_address;
5191d88acc68874 Nick Dyer 2016-12-10  368  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  369  				"%s: Core code block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  370  				__func__, blkcount->ui_firmware);
5191d88acc68874 Nick Dyer 2016-12-10  371  			break;
5191d88acc68874 Nick Dyer 2016-12-10  372  		case CORE_CONFIG_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  373  			blkcount->ui_config = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  374  			phyaddr->ui_config = physical_address;
5191d88acc68874 Nick Dyer 2016-12-10  375  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  376  				"%s: Core config block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  377  				__func__, blkcount->ui_config);
5191d88acc68874 Nick Dyer 2016-12-10  378  			break;
5191d88acc68874 Nick Dyer 2016-12-10  379  		case DISPLAY_CONFIG_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  380  			blkcount->dp_config = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  381  			phyaddr->dp_config = physical_address;
5191d88acc68874 Nick Dyer 2016-12-10  382  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  383  				"%s: Display config block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  384  				__func__, blkcount->dp_config);
5191d88acc68874 Nick Dyer 2016-12-10  385  			break;
5191d88acc68874 Nick Dyer 2016-12-10  386  		case FLASH_CONFIG_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  387  			blkcount->fl_config = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  388  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  389  				"%s: Flash config block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  390  				__func__, blkcount->fl_config);
5191d88acc68874 Nick Dyer 2016-12-10  391  			break;
5191d88acc68874 Nick Dyer 2016-12-10  392  		case GUEST_CODE_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  393  			blkcount->guest_code = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  394  			phyaddr->guest_code = physical_address;
5191d88acc68874 Nick Dyer 2016-12-10  395  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  396  				"%s: Guest code block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  397  				__func__, blkcount->guest_code);
5191d88acc68874 Nick Dyer 2016-12-10  398  			break;
5191d88acc68874 Nick Dyer 2016-12-10  399  		case GUEST_SERIALIZATION_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  400  			blkcount->pm_config = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  401  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  402  				"%s: Guest serialization block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  403  				__func__, blkcount->pm_config);
5191d88acc68874 Nick Dyer 2016-12-10  404  			break;
5191d88acc68874 Nick Dyer 2016-12-10  405  		case GLOBAL_PARAMETERS_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  406  			blkcount->bl_config = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  407  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  408  				"%s: Global parameters block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  409  				__func__, blkcount->bl_config);
5191d88acc68874 Nick Dyer 2016-12-10  410  			break;
5191d88acc68874 Nick Dyer 2016-12-10  411  		case DEVICE_CONFIG_PARTITION:
5191d88acc68874 Nick Dyer 2016-12-10  412  			blkcount->lockdown = partition_length;
5191d88acc68874 Nick Dyer 2016-12-10  413  			rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev,
5191d88acc68874 Nick Dyer 2016-12-10  414  				"%s: Device config block count: %d\n",
5191d88acc68874 Nick Dyer 2016-12-10  415  				__func__, blkcount->lockdown);
5191d88acc68874 Nick Dyer 2016-12-10  416  			break;
5191d88acc68874 Nick Dyer 2016-12-10  417  		}
5191d88acc68874 Nick Dyer 2016-12-10  418  	}
5191d88acc68874 Nick Dyer 2016-12-10  419  }
5191d88acc68874 Nick Dyer 2016-12-10  420  

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

Patch

diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index 25df6320f9f1..62a93d7d98f8 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -195,5 +195,6 @@  int rmi_of_property_read_u32(struct device *dev, u32 *result,
 #define RMI_DEBUG_FN			BIT(2)
 #define RMI_DEBUG_2D_SENSOR		BIT(3)
 
+__printf(3, 4)
 void rmi_dbg(int flags, struct device *dev, const char *fmt, ...);
 #endif