public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ben Skeggs <bskeggs@redhat.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Lyude Paul <lyude@redhat.com>
Subject: drivers/gpu/drm/nouveau/nouveau_bo0039.c:59:13: warning: Variable 'page_count' is reassigned a value before the old one has been used.
Date: Fri, 7 Aug 2020 08:53:52 +0800	[thread overview]
Message-ID: <202008070848.smbIQF1R%lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7b4ea9456dd3f73238408126ab00f1d906963d81
commit: 8b9d5d63a7193156b6b397c4f5078efbc200695f drm/nouveau/bo: split buffer move functions into their own source files
date:   2 weeks ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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

>> drivers/gpu/drm/nouveau/nouveau_bo0039.c:59:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo0039.c:48:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo0039.c:59:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^
--
>> drivers/gpu/drm/nouveau/nouveau_bo85b5.c:47:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo85b5.c:44:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo85b5.c:47:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^
>> drivers/gpu/drm/nouveau/nouveau_bo9039.c:43:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo9039.c:40:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo9039.c:43:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^
>> drivers/gpu/drm/nouveau/nouveau_bo90b5.c:40:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo90b5.c:37:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo90b5.c:40:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^

vim +/page_count +59 drivers/gpu/drm/nouveau/nouveau_bo0039.c

    41	
    42	int
    43	nv04_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
    44			  struct ttm_mem_reg *old_reg, struct ttm_mem_reg *new_reg)
    45	{
    46		u32 src_offset = old_reg->start << PAGE_SHIFT;
    47		u32 dst_offset = new_reg->start << PAGE_SHIFT;
    48		u32 page_count = new_reg->num_pages;
    49		int ret;
    50	
    51		ret = RING_SPACE(chan, 3);
    52		if (ret)
    53			return ret;
    54	
    55		BEGIN_NV04(chan, NvSubCopy, NV_MEMORY_TO_MEMORY_FORMAT_DMA_SOURCE, 2);
    56		OUT_RING  (chan, nouveau_bo_mem_ctxdma(bo, chan, old_reg));
    57		OUT_RING  (chan, nouveau_bo_mem_ctxdma(bo, chan, new_reg));
    58	
  > 59		page_count = new_reg->num_pages;
    60		while (page_count) {
    61			int line_count = (page_count > 2047) ? 2047 : page_count;
    62	
    63			ret = RING_SPACE(chan, 11);
    64			if (ret)
    65				return ret;
    66	
    67			BEGIN_NV04(chan, NvSubCopy,
    68					 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
    69			OUT_RING  (chan, src_offset);
    70			OUT_RING  (chan, dst_offset);
    71			OUT_RING  (chan, PAGE_SIZE); /* src_pitch */
    72			OUT_RING  (chan, PAGE_SIZE); /* dst_pitch */
    73			OUT_RING  (chan, PAGE_SIZE); /* line_length */
    74			OUT_RING  (chan, line_count);
    75			OUT_RING  (chan, 0x00000101);
    76			OUT_RING  (chan, 0x00000000);
    77			BEGIN_NV04(chan, NvSubCopy, NV_MEMORY_TO_MEMORY_FORMAT_NOP, 1);
    78			OUT_RING  (chan, 0);
    79	
    80			page_count -= line_count;
    81			src_offset += (PAGE_SIZE * line_count);
    82			dst_offset += (PAGE_SIZE * line_count);
    83		}
    84	
    85		return 0;
    86	}
    87	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

                 reply	other threads:[~2020-08-07  0:54 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=202008070848.smbIQF1R%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bskeggs@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    /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