lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202503181425.OndgH7Dh-lkp@intel.com>
Date: Tue, 18 Mar 2025 14:54:50 +0800
From: kernel test robot <lkp@...el.com>
To: Potin Lai <potin.lai.pt@...il.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Patrick Williams <patrick@...cx.xyz>
Cc: oe-kbuild-all@...ts.linux.dev, linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org, Cosmo Chou <cosmo.chou@...ntatw.com>,
	Potin Lai <potin.lai@...ntatw.com>
Subject: Re: [PATCH] gpio: pca953x: Add support for level-triggered interrupts

Hi Potin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 2014c95afecee3e76ca4a56956a936e23283f05b]

url:    https://github.com/intel-lab-lkp/linux/commits/Potin-Lai/gpio-pca953x-Add-support-for-level-triggered-interrupts/20250318-004441
base:   2014c95afecee3e76ca4a56956a936e23283f05b
patch link:    https://lore.kernel.org/r/20250318-gpio-pca953x-level-triggered-irq-v1-1-0c4943d92425%40gmail.com
patch subject: [PATCH] gpio: pca953x: Add support for level-triggered interrupts
config: arm-randconfig-001-20250318 (https://download.01.org/0day-ci/archive/20250318/202503181425.OndgH7Dh-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250318/202503181425.OndgH7Dh-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503181425.OndgH7Dh-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/gpio/gpio-pca953x.c: In function 'pca953x_irq_pending':
>> drivers/gpio/gpio-pca953x.c:887:13: warning: the comparison will always evaluate as 'true' for the address of 'irq_trig_level_high' will never be NULL [-Waddress]
     887 |         if (!chip->irq_trig_level_high && !chip->irq_trig_level_low) {
         |             ^
   In file included from include/linux/atomic.h:5,
                    from drivers/gpio/gpio-pca953x.c:11:
   drivers/gpio/gpio-pca953x.c:218:24: note: 'irq_trig_level_high' declared here
     218 |         DECLARE_BITMAP(irq_trig_level_high, MAX_LINE);
         |                        ^~~~~~~~~~~~~~~~~~~
   include/linux/types.h:11:23: note: in definition of macro 'DECLARE_BITMAP'
      11 |         unsigned long name[BITS_TO_LONGS(bits)]
         |                       ^~~~
>> drivers/gpio/gpio-pca953x.c:887:43: warning: the comparison will always evaluate as 'true' for the address of 'irq_trig_level_low' will never be NULL [-Waddress]
     887 |         if (!chip->irq_trig_level_high && !chip->irq_trig_level_low) {
         |                                           ^
   drivers/gpio/gpio-pca953x.c:219:24: note: 'irq_trig_level_low' declared here
     219 |         DECLARE_BITMAP(irq_trig_level_low, MAX_LINE);
         |                        ^~~~~~~~~~~~~~~~~~
   include/linux/types.h:11:23: note: in definition of macro 'DECLARE_BITMAP'
      11 |         unsigned long name[BITS_TO_LONGS(bits)]
         |                       ^~~~


vim +887 drivers/gpio/gpio-pca953x.c

   841	
   842	static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pending)
   843	{
   844		struct gpio_chip *gc = &chip->gpio_chip;
   845		DECLARE_BITMAP(reg_direction, MAX_LINE);
   846		DECLARE_BITMAP(old_stat, MAX_LINE);
   847		DECLARE_BITMAP(cur_stat, MAX_LINE);
   848		DECLARE_BITMAP(new_stat, MAX_LINE);
   849		DECLARE_BITMAP(trigger, MAX_LINE);
   850		DECLARE_BITMAP(edges, MAX_LINE);
   851		int ret;
   852	
   853		if (chip->driver_data & PCA_PCAL) {
   854			/* Read the current interrupt status from the device */
   855			ret = pca953x_read_regs(chip, PCAL953X_INT_STAT, trigger);
   856			if (ret)
   857				return false;
   858	
   859			/* Check latched inputs and clear interrupt status */
   860			ret = pca953x_read_regs(chip, chip->regs->input, cur_stat);
   861			if (ret)
   862				return false;
   863	
   864			/* Apply filter for rising/falling edge selection */
   865			bitmap_replace(new_stat, chip->irq_trig_fall, chip->irq_trig_raise, cur_stat, gc->ngpio);
   866	
   867			bitmap_and(pending, new_stat, trigger, gc->ngpio);
   868	
   869			return !bitmap_empty(pending, gc->ngpio);
   870		}
   871	
   872		ret = pca953x_read_regs(chip, chip->regs->input, cur_stat);
   873		if (ret)
   874			return false;
   875	
   876		/* Remove output pins from the equation */
   877		pca953x_read_regs(chip, chip->regs->direction, reg_direction);
   878	
   879		bitmap_copy(old_stat, chip->irq_stat, gc->ngpio);
   880	
   881		bitmap_and(new_stat, cur_stat, reg_direction, gc->ngpio);
   882		bitmap_xor(cur_stat, new_stat, old_stat, gc->ngpio);
   883		bitmap_and(trigger, cur_stat, chip->irq_mask, gc->ngpio);
   884	
   885		bitmap_copy(chip->irq_stat, new_stat, gc->ngpio);
   886	
 > 887		if (!chip->irq_trig_level_high && !chip->irq_trig_level_low) {
   888			if (bitmap_empty(trigger, gc->ngpio))
   889				return false;
   890		}
   891	
   892		bitmap_and(cur_stat, chip->irq_trig_fall, old_stat, gc->ngpio);
   893		bitmap_and(old_stat, chip->irq_trig_raise, new_stat, gc->ngpio);
   894		bitmap_or(edges, old_stat, cur_stat, gc->ngpio);
   895		bitmap_and(pending, edges, trigger, gc->ngpio);
   896	
   897		bitmap_and(cur_stat, new_stat, chip->irq_trig_level_high, gc->ngpio);
   898		bitmap_and(cur_stat, cur_stat, chip->irq_mask, gc->ngpio);
   899		bitmap_or(pending, pending, cur_stat, gc->ngpio);
   900	
   901		bitmap_complement(cur_stat, new_stat, gc->ngpio);
   902		bitmap_and(cur_stat, cur_stat, reg_direction, gc->ngpio);
   903		bitmap_and(old_stat, cur_stat, chip->irq_trig_level_low, gc->ngpio);
   904		bitmap_and(old_stat, old_stat, chip->irq_mask, gc->ngpio);
   905		bitmap_or(pending, pending, old_stat, gc->ngpio);
   906	
   907		return !bitmap_empty(pending, gc->ngpio);
   908	}
   909	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ