public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Greg Ungerer <gerg@kernel.org>
Subject: arch/m68k/coldfire/gpio.c:27 __mcfgpio_set_value() warn: unsigned 'gpio' is never less than zero.
Date: Wed, 5 Feb 2025 21:57:20 +0800	[thread overview]
Message-ID: <202502052133.bpeqHMoZ-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5c8c229261f14159b54b9a32f12e5fa89d88b905
commit: f212140962c93cd5da43283a18e31681540fc23d m68k: mcfgpio: Fix incorrect register offset for CONFIG_M5441x
date:   3 months ago
config: m68k-randconfig-r072-20250205 (https://download.01.org/0day-ci/archive/20250205/202502052133.bpeqHMoZ-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.2.0

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502052133.bpeqHMoZ-lkp@intel.com/

New smatch warnings:
arch/m68k/coldfire/gpio.c:27 __mcfgpio_set_value() warn: unsigned 'gpio' is never less than zero.
arch/m68k/coldfire/gpio.c:76 __mcfgpio_direction_output() warn: unsigned 'gpio' is never less than zero.

Old smatch warnings:
arch/m68k/include/asm/io_no.h:50 __cf_internalio() warn: always true condition '(addr <= 3758096384 + 536870912 - 1) => (0-u32max <= u32max)'

vim +/gpio +27 arch/m68k/coldfire/gpio.c

af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  24  
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  25  void __mcfgpio_set_value(unsigned gpio, int value)
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  26  {
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21 @27  	if (gpio < MCFGPIO_SCR_START) {
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  28  		unsigned long flags;
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  29  		MCFGPIO_PORTTYPE data;
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  30  
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  31  		local_irq_save(flags);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  32  		data = mcfgpio_read(__mcfgpio_podr(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  33  		if (value)
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  34  			data |= mcfgpio_bit(gpio);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  35  		else
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  36  			data &= ~mcfgpio_bit(gpio);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  37  		mcfgpio_write(data, __mcfgpio_podr(gpio));
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  38  		local_irq_restore(flags);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  39  	} else {
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  40  		if (value)
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  41  			mcfgpio_write(mcfgpio_bit(gpio),
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  42  					MCFGPIO_SETR_PORT(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  43  		else
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  44  			mcfgpio_write(~mcfgpio_bit(gpio),
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  45  					MCFGPIO_CLRR_PORT(gpio));
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  46  	}
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  47  }
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  48  EXPORT_SYMBOL(__mcfgpio_set_value);
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  49  
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  50  int __mcfgpio_direction_input(unsigned gpio)
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  51  {
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  52  	unsigned long flags;
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  53  	MCFGPIO_PORTTYPE dir;
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  54  
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  55  	local_irq_save(flags);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  56  	dir = mcfgpio_read(__mcfgpio_pddr(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  57  	dir &= ~mcfgpio_bit(gpio);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  58  	mcfgpio_write(dir, __mcfgpio_pddr(gpio));
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  59  	local_irq_restore(flags);
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  60  
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  61  	return 0;
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  62  }
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  63  EXPORT_SYMBOL(__mcfgpio_direction_input);
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  64  
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  65  int __mcfgpio_direction_output(unsigned gpio, int value)
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  66  {
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  67  	unsigned long flags;
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  68  	MCFGPIO_PORTTYPE data;
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  69  
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  70  	local_irq_save(flags);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  71  	data = mcfgpio_read(__mcfgpio_pddr(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  72  	data |= mcfgpio_bit(gpio);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  73  	mcfgpio_write(data, __mcfgpio_pddr(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  74  
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  75  	/* now set the data to output */
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21 @76  	if (gpio < MCFGPIO_SCR_START) {
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  77  		data = mcfgpio_read(__mcfgpio_podr(gpio));
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  78  		if (value)
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  79  			data |= mcfgpio_bit(gpio);
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  80  		else
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  81  			data &= ~mcfgpio_bit(gpio);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  82  		mcfgpio_write(data, __mcfgpio_podr(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  83  	} else {
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  84  		 if (value)
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  85  			mcfgpio_write(mcfgpio_bit(gpio),
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  86  					MCFGPIO_SETR_PORT(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  87  		 else
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  88  			 mcfgpio_write(~mcfgpio_bit(gpio),
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  89  					 MCFGPIO_CLRR_PORT(gpio));
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  90  	}
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  91  	local_irq_restore(flags);
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  92  	return 0;
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  93  }
eac57949947fa2 arch/m68k/platform/coldfire/gpio.c      Steven King      2012-05-21  94  EXPORT_SYMBOL(__mcfgpio_direction_output);
af39bb8b07af83 arch/m68knommu/platform/coldfire/gpio.c sfking@fdwdc.com 2009-06-19  95  

:::::: The code at line 27 was first introduced by commit
:::::: eac57949947fa24f47a2e993a1dbbfdb573b4301 m68knommu: refactor Coldfire GPIO not to require GPIOLIB, eliminate mcf_gpio_chips.

:::::: TO: Steven King <sfking@fdwdc.com>
:::::: CC: Greg Ungerer <gerg@uclinux.org>

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

                 reply	other threads:[~2025-02-05 13:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202502052133.bpeqHMoZ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gerg@kernel.org \
    --cc=jeanmichel.hautbois@yoseli.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox