All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]
@ 2023-01-29 17:37 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-01-29 17:37 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Thomas Gleixner <tglx@linutronix.de>
CC: Kevin Tian <kevin.tian@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c96618275234ad03d44eafe9f8844305bb44fda4
commit: 3d393b21740bffbeeae7d4fa534a6b16c3e3e832 genirq/msi: Provide msi_domain_alloc_irq_at()
date:   8 weeks ago
:::::: branch date: 22 hours ago
:::::: commit date: 8 weeks ago
compiler: csky-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 3d393b21740bffbeeae7d4fa534a6b16c3e3e832
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]
     unsigned int index;
                  ^
   kernel/irq/msi.c:85:40: note: Shadowed declaration
         unsigned int domid, unsigned int index)
                                          ^
   kernel/irq/msi.c:96:16: note: Shadow variable
     unsigned int index;
                  ^
>> kernel/irq/msi.c:1445:39: warning: Parameter 'icookie' can be declared as pointer to const [constParameter]
              union msi_instance_cookie *icookie)
                                         ^

vim +/index +96 kernel/irq/msi.c

aa48b6f708868a Jiang Liu       2015-07-09   83  
36db3d9003ea85 Thomas Gleixner 2022-11-25   84  static int msi_insert_desc(struct device *dev, struct msi_desc *desc,
fc8ab388325ddf Thomas Gleixner 2022-11-25   85  			   unsigned int domid, unsigned int index)
cd6cf06590b979 Thomas Gleixner 2021-12-06   86  {
36db3d9003ea85 Thomas Gleixner 2022-11-25   87  	struct msi_device_data *md = dev->msi.data;
fc8ab388325ddf Thomas Gleixner 2022-11-25   88  	struct xarray *xa = &md->__domains[domid].store;
36db3d9003ea85 Thomas Gleixner 2022-11-25   89  	unsigned int hwsize;
cd6cf06590b979 Thomas Gleixner 2021-12-06   90  	int ret;
cd6cf06590b979 Thomas Gleixner 2021-12-06   91  
36db3d9003ea85 Thomas Gleixner 2022-11-25   92  	hwsize = msi_domain_get_hwsize(dev, domid);
3d393b21740bff Thomas Gleixner 2022-11-25   93  
3d393b21740bff Thomas Gleixner 2022-11-25   94  	if (index == MSI_ANY_INDEX) {
3d393b21740bff Thomas Gleixner 2022-11-25   95  		struct xa_limit limit = { .min = 0, .max = hwsize - 1 };
3d393b21740bff Thomas Gleixner 2022-11-25  @96  		unsigned int index;
3d393b21740bff Thomas Gleixner 2022-11-25   97  
3d393b21740bff Thomas Gleixner 2022-11-25   98  		/* Let the xarray allocate a free index within the limit */
3d393b21740bff Thomas Gleixner 2022-11-25   99  		ret = xa_alloc(xa, &index, desc, limit, GFP_KERNEL);
3d393b21740bff Thomas Gleixner 2022-11-25  100  		if (ret)
3d393b21740bff Thomas Gleixner 2022-11-25  101  			goto fail;
3d393b21740bff Thomas Gleixner 2022-11-25  102  
3d393b21740bff Thomas Gleixner 2022-11-25  103  		desc->msi_index = index;
3d393b21740bff Thomas Gleixner 2022-11-25  104  		return 0;
3d393b21740bff Thomas Gleixner 2022-11-25  105  	} else {
36db3d9003ea85 Thomas Gleixner 2022-11-25  106  		if (index >= hwsize) {
36db3d9003ea85 Thomas Gleixner 2022-11-25  107  			ret = -ERANGE;
36db3d9003ea85 Thomas Gleixner 2022-11-25  108  			goto fail;
36db3d9003ea85 Thomas Gleixner 2022-11-25  109  		}
36db3d9003ea85 Thomas Gleixner 2022-11-25  110  
cd6cf06590b979 Thomas Gleixner 2021-12-06  111  		desc->msi_index = index;
f1139f905bd2d8 Thomas Gleixner 2022-11-25  112  		ret = xa_insert(xa, index, desc, GFP_KERNEL);
cd6cf06590b979 Thomas Gleixner 2021-12-06  113  		if (ret)
36db3d9003ea85 Thomas Gleixner 2022-11-25  114  			goto fail;
36db3d9003ea85 Thomas Gleixner 2022-11-25  115  		return 0;
3d393b21740bff Thomas Gleixner 2022-11-25  116  	}
36db3d9003ea85 Thomas Gleixner 2022-11-25  117  fail:
cd6cf06590b979 Thomas Gleixner 2021-12-06  118  	msi_free_desc(desc);
cd6cf06590b979 Thomas Gleixner 2021-12-06  119  	return ret;
cd6cf06590b979 Thomas Gleixner 2021-12-06  120  }
cd6cf06590b979 Thomas Gleixner 2021-12-06  121  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread
* kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]
@ 2023-02-26 21:48 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-02-26 21:48 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Thomas Gleixner <tglx@linutronix.de>
CC: Kevin Tian <kevin.tian@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f3a2439f20d918930cc4ae8f76fe1c1afd26958f
commit: 3d393b21740bffbeeae7d4fa534a6b16c3e3e832 genirq/msi: Provide msi_domain_alloc_irq_at()
date:   3 months ago
:::::: branch date: 81 minutes ago
:::::: commit date: 3 months ago
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 3d393b21740bffbeeae7d4fa534a6b16c3e3e832
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/r/202302270539.3oPoYYuI-lkp@intel.com/


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]
     unsigned int index;
                  ^
   kernel/irq/msi.c:85:40: note: Shadowed declaration
         unsigned int domid, unsigned int index)
                                          ^
   kernel/irq/msi.c:96:16: note: Shadow variable
     unsigned int index;
                  ^
>> kernel/irq/msi.c:1445:39: warning: Parameter 'icookie' can be declared as pointer to const [constParameter]
              union msi_instance_cookie *icookie)
                                         ^

vim +/index +96 kernel/irq/msi.c

aa48b6f708868a Jiang Liu       2015-07-09   83  
36db3d9003ea85 Thomas Gleixner 2022-11-25   84  static int msi_insert_desc(struct device *dev, struct msi_desc *desc,
fc8ab388325ddf Thomas Gleixner 2022-11-25   85  			   unsigned int domid, unsigned int index)
cd6cf06590b979 Thomas Gleixner 2021-12-06   86  {
36db3d9003ea85 Thomas Gleixner 2022-11-25   87  	struct msi_device_data *md = dev->msi.data;
fc8ab388325ddf Thomas Gleixner 2022-11-25   88  	struct xarray *xa = &md->__domains[domid].store;
36db3d9003ea85 Thomas Gleixner 2022-11-25   89  	unsigned int hwsize;
cd6cf06590b979 Thomas Gleixner 2021-12-06   90  	int ret;
cd6cf06590b979 Thomas Gleixner 2021-12-06   91  
36db3d9003ea85 Thomas Gleixner 2022-11-25   92  	hwsize = msi_domain_get_hwsize(dev, domid);
3d393b21740bff Thomas Gleixner 2022-11-25   93  
3d393b21740bff Thomas Gleixner 2022-11-25   94  	if (index == MSI_ANY_INDEX) {
3d393b21740bff Thomas Gleixner 2022-11-25   95  		struct xa_limit limit = { .min = 0, .max = hwsize - 1 };
3d393b21740bff Thomas Gleixner 2022-11-25  @96  		unsigned int index;
3d393b21740bff Thomas Gleixner 2022-11-25   97  
3d393b21740bff Thomas Gleixner 2022-11-25   98  		/* Let the xarray allocate a free index within the limit */
3d393b21740bff Thomas Gleixner 2022-11-25   99  		ret = xa_alloc(xa, &index, desc, limit, GFP_KERNEL);
3d393b21740bff Thomas Gleixner 2022-11-25  100  		if (ret)
3d393b21740bff Thomas Gleixner 2022-11-25  101  			goto fail;
3d393b21740bff Thomas Gleixner 2022-11-25  102  
3d393b21740bff Thomas Gleixner 2022-11-25  103  		desc->msi_index = index;
3d393b21740bff Thomas Gleixner 2022-11-25  104  		return 0;
3d393b21740bff Thomas Gleixner 2022-11-25  105  	} else {
36db3d9003ea85 Thomas Gleixner 2022-11-25  106  		if (index >= hwsize) {
36db3d9003ea85 Thomas Gleixner 2022-11-25  107  			ret = -ERANGE;
36db3d9003ea85 Thomas Gleixner 2022-11-25  108  			goto fail;
36db3d9003ea85 Thomas Gleixner 2022-11-25  109  		}
36db3d9003ea85 Thomas Gleixner 2022-11-25  110  
cd6cf06590b979 Thomas Gleixner 2021-12-06  111  		desc->msi_index = index;
f1139f905bd2d8 Thomas Gleixner 2022-11-25  112  		ret = xa_insert(xa, index, desc, GFP_KERNEL);
cd6cf06590b979 Thomas Gleixner 2021-12-06  113  		if (ret)
36db3d9003ea85 Thomas Gleixner 2022-11-25  114  			goto fail;
36db3d9003ea85 Thomas Gleixner 2022-11-25  115  		return 0;
3d393b21740bff Thomas Gleixner 2022-11-25  116  	}
36db3d9003ea85 Thomas Gleixner 2022-11-25  117  fail:
cd6cf06590b979 Thomas Gleixner 2021-12-06  118  	msi_free_desc(desc);
cd6cf06590b979 Thomas Gleixner 2021-12-06  119  	return ret;
cd6cf06590b979 Thomas Gleixner 2021-12-06  120  }
cd6cf06590b979 Thomas Gleixner 2021-12-06  121  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-26 21:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-29 17:37 kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-02-26 21:48 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.