Re: [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support

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

 



Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on linus/master v6.0-rc1 next-20220819]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Gireesh-Hiremath-in-bosch-com/driver-input-matric-keypad-switch-to-gpiod/20220819-151155
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: s390-randconfig-r044-20220819 (https://download.01.org/0day-ci/archive/20220819/202208191937.Y6z0Gjrt-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 0ac597f3cacf60479ffd36b03766fa7462dabd78)
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 s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/a0b420e08e3b8775a3dbc4857f6ef4831db1c2b3
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Gireesh-Hiremath-in-bosch-com/driver-input-matric-keypad-switch-to-gpiod/20220819-151155
        git checkout a0b420e08e3b8775a3dbc4857f6ef4831db1c2b3
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/input/keyboard/

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

All warnings (new ones prefixed by >>):

   In file included from drivers/input/keyboard/matrix_keypad.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from drivers/input/keyboard/matrix_keypad.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from drivers/input/keyboard/matrix_keypad.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> drivers/input/keyboard/matrix_keypad.c:857:3: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                   if (!keypad->button_array) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/keyboard/matrix_keypad.c:932:9: note: uninitialized use occurs here
           return err;
                  ^~~
   drivers/input/keyboard/matrix_keypad.c:857:3: note: remove the 'if' if its condition is always false
                   if (!keypad->button_array) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/input/keyboard/matrix_keypad.c:828:9: note: initialize the variable 'err' to silence this warning
           int err;
                  ^
                   = 0
>> drivers/input/keyboard/matrix_keypad.c:65:33: warning: unused variable 'keypad_infos' [-Wunused-const-variable]
   static const struct keypad_info keypad_infos[] = {
                                   ^
   14 warnings generated.


vim +857 drivers/input/keyboard/matrix_keypad.c

   822	
   823	static int matrix_keypad_probe(struct platform_device *pdev)
   824	{
   825		const struct matrix_keypad_platform_data *pdata;
   826		struct matrix_keypad *keypad;
   827		struct input_dev *input_dev;
 > 828		int err;
   829	
   830		pdata = dev_get_platdata(&pdev->dev);
   831		if (!pdata) {
   832			pdata = matrix_keypad_parse_dt(&pdev->dev);
   833			if (IS_ERR(pdata))
   834				return PTR_ERR(pdata);
   835		} else if (!pdata->keymap_data) {
   836			dev_err(&pdev->dev, "no keymap data defined\n");
   837			return -EINVAL;
   838		}
   839	
   840		keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL);
   841		input_dev = input_allocate_device();
   842		if (!keypad || !input_dev) {
   843			err = -ENOMEM;
   844			goto err_free_mem;
   845		}
   846	
   847		keypad->input_dev = input_dev;
   848		keypad->pdata = pdata;
   849		keypad->row_shift = get_count_order(pdata->num_col_gpios);
   850		keypad->stopped = true;
   851	
   852		if (pdata->mode == REDUCED) {
   853			keypad->button_array = devm_kzalloc(
   854				&pdev->dev,
   855				sizeof(struct button) * (pdata->num_of_buttons),
   856				GFP_KERNEL);
 > 857			if (!keypad->button_array) {
   858				dev_err(&pdev->dev,
   859					"could not allocate memory for button array\n");
   860				goto err_free_mem;
   861				;
   862			}
   863	
   864			poll_prepare(keypad);
   865	
   866			err = input_setup_polling(input_dev, matrix_keypad_poll);
   867			if (err) {
   868				dev_err(&pdev->dev,
   869					"unable to set up polling, err=%d\n", err);
   870				return err;
   871			}
   872	
   873			input_set_poll_interval(input_dev, pdata->poll_interval_ms);
   874		} else {
   875			INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan);
   876		}
   877		spin_lock_init(&keypad->lock);
   878	
   879		input_dev->name = pdev->name;
   880		input_dev->id.bustype = BUS_HOST;
   881		input_dev->dev.parent = &pdev->dev;
   882		input_dev->open = matrix_keypad_start;
   883		input_dev->close = matrix_keypad_stop;
   884	
   885		if (pdata->mode == REDUCED) {
   886			err = matrix_keypad_build_keymap(pdata->keymap_data, NULL,
   887							 pdata->num_line_gpios,
   888							 pdata->num_line_gpios, NULL,
   889							 input_dev);
   890			if (err) {
   891				dev_err(&pdev->dev, "failed to build keymap for reduced mode\n");
   892				goto err_free_mem;
   893			}
   894		} else {
   895			err = matrix_keypad_build_keymap(pdata->keymap_data, NULL,
   896							 pdata->num_row_gpios,
   897							 pdata->num_col_gpios, NULL,
   898							 input_dev);
   899			if (err) {
   900				dev_err(&pdev->dev, "failed to build keymap for generic mode\n");
   901				goto err_free_mem;
   902			}
   903		}
   904	
   905		if (!pdata->no_autorepeat)
   906			__set_bit(EV_REP, input_dev->evbit);
   907		input_set_capability(input_dev, EV_MSC, MSC_SCAN);
   908		input_set_drvdata(input_dev, keypad);
   909	
   910		if (pdata->mode == REDUCED) {
   911			button_hdl_init(keypad);
   912		} else {
   913			err = matrix_keypad_init_gpio(pdev, keypad);
   914			if (err)
   915				goto err_free_mem;
   916		}
   917	
   918		err = input_register_device(keypad->input_dev);
   919		if (err)
   920			goto err_free_gpio;
   921	
   922		device_init_wakeup(&pdev->dev, pdata->wakeup);
   923		platform_set_drvdata(pdev, keypad);
   924	
   925		return 0;
   926	
   927	err_free_gpio:
   928		matrix_keypad_free_gpio(keypad);
   929	err_free_mem:
   930		input_free_device(input_dev);
   931		kfree(keypad);
   932		return err;
   933	}
   934	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux