mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	David Sterba <dsterba@suse.com>,
	Nikolay Borisov <nborisov@suse.com>
Subject: [kdave-btrfs-devel:misc-next 67/136] fs/btrfs/extent_io.c:5952:7: warning: Local variable 'ret' shadows outer variable [shadowVariable]
Date: Sat, 23 Apr 2022 21:05:09 +0800	[thread overview]
Message-ID: <202204232126.HLpn2Rg5-lkp@intel.com> (raw)

tree:   https://github.com/kdave/btrfs-devel.git misc-next
head:   446e59dd6c55d120dc09444a1f086e5a81898665
commit: 55093e751296ec57c65374e1e0378f6d32946389 [67/136] btrfs: factor out allocating an array of pages
compiler: microblaze-linux-gcc (GCC) 11.2.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 55093e751296ec57c65374e1e0378f6d32946389
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

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


cppcheck warnings: (new ones prefixed by >>)
        ^
>> fs/btrfs/extent_io.c:5952:7: warning: Local variable 'ret' shadows outer variable [shadowVariable]
     int ret;
         ^
   fs/btrfs/extent_io.c:5931:6: note: Shadowed declaration
    int ret;
        ^
   fs/btrfs/extent_io.c:5952:7: note: Shadow variable
     int ret;
         ^

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

        ^
   fs/btrfs/extent_io.c:369:26: warning: Parameter 'p_in' can be declared with const [constParameter]
          struct rb_node ***p_in,
                            ^
   fs/btrfs/extent_io.c:370:25: warning: Parameter 'parent_in' can be declared with const [constParameter]
          struct rb_node **parent_in)
                           ^
   fs/btrfs/extent_io.c:1823:30: warning: Parameter 'mapping' can be declared with const [constParameter]
          struct address_space *mapping,
                                ^
   fs/btrfs/extent_io.c:1824:40: warning: Parameter 'locked_page' can be declared with const [constParameter]
          struct page *page, struct page *locked_page,
                                          ^
   fs/btrfs/extent_io.c:6052:16: warning: Parameter 'accessed' can be declared with const [constParameter]
     struct page *accessed)
                  ^

vim +/ret +5952 fs/btrfs/extent_io.c

  5925	
  5926	struct extent_buffer *btrfs_clone_extent_buffer(const struct extent_buffer *src)
  5927	{
  5928		int i;
  5929		struct extent_buffer *new;
  5930		int num_pages = num_extent_pages(src);
  5931		int ret;
  5932	
  5933		new = __alloc_extent_buffer(src->fs_info, src->start, src->len);
  5934		if (new == NULL)
  5935			return NULL;
  5936	
  5937		/*
  5938		 * Set UNMAPPED before calling btrfs_release_extent_buffer(), as
  5939		 * btrfs_release_extent_buffer() have different behavior for
  5940		 * UNMAPPED subpage extent buffer.
  5941		 */
  5942		set_bit(EXTENT_BUFFER_UNMAPPED, &new->bflags);
  5943	
  5944		memset(new->pages, 0, sizeof(*new->pages) * num_pages);
  5945		ret = btrfs_alloc_page_array(num_pages, new->pages);
  5946		if (ret) {
  5947			btrfs_release_extent_buffer(new);
  5948			return NULL;
  5949		}
  5950	
  5951		for (i = 0; i < num_pages; i++) {
> 5952			int ret;
  5953			struct page *p = new->pages[i];
  5954	
  5955			ret = attach_extent_buffer_page(new, p, NULL);
  5956			if (ret < 0) {
  5957				btrfs_release_extent_buffer(new);
  5958				return NULL;
  5959			}
  5960			WARN_ON(PageDirty(p));
  5961			copy_page(page_address(p), page_address(src->pages[i]));
  5962		}
  5963		set_extent_buffer_uptodate(new);
  5964	
  5965		return new;
  5966	}
  5967	

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

                 reply	other threads:[~2022-04-23 13:06 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=202204232126.HLpn2Rg5-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dsterba@suse.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=sweettea-kernel@dorminy.me \
    /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

all inboxes | Powered by JetHome®