All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: kernel/irq/msi.c:96:16: warning: Local variable 'index' shadows outer argument [shadowArgument]
Date: Mon, 30 Jan 2023 01:37:35 +0800	[thread overview]
Message-ID: <202301300150.GKbVOFfh-lkp@intel.com> (raw)

:::::: 
:::::: 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

             reply	other threads:[~2023-01-29 17:38 UTC|newest]

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

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=202301300150.GKbVOFfh-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@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 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.