From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/gpu/drm/i915/gt/shmem_utils.c:76:13: warning: Unsigned variable '--' can't be negative so it is unnecessary to test it.
Date: Thu, 29 Oct 2020 00:54:03 +0800 [thread overview]
Message-ID: <202010290000.pgXQ1LCb-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3354 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Christoph Hellwig <hch@lst.de>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ed8780e3f2ecc82645342d070c6b4e530532e680
commit: bfed6708d6c97406d14420f3288ee775c284ff8a drm/i915: use vmap in shmem_pin_map
date: 10 days ago
:::::: branch date: 19 hours ago
:::::: commit date: 10 days 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 possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/gpu/drm/i915/gt/shmem_utils.c:76:13: warning: Unsigned variable '--' can't be negative so it is unnecessary to test it. [unsignedPositive]
while (--i >= 0)
^
vim +76 drivers/gpu/drm/i915/gt/shmem_utils.c
be1cb55a07bfc5 Chris Wilson 2020-04-29 51
be1cb55a07bfc5 Chris Wilson 2020-04-29 52 void *shmem_pin_map(struct file *file)
be1cb55a07bfc5 Chris Wilson 2020-04-29 53 {
bfed6708d6c974 Christoph Hellwig 2020-10-17 54 struct page **pages;
bfed6708d6c974 Christoph Hellwig 2020-10-17 55 size_t n_pages, i;
bfed6708d6c974 Christoph Hellwig 2020-10-17 56 void *vaddr;
be1cb55a07bfc5 Chris Wilson 2020-04-29 57
bfed6708d6c974 Christoph Hellwig 2020-10-17 58 n_pages = file->f_mapping->host->i_size >> PAGE_SHIFT;
bfed6708d6c974 Christoph Hellwig 2020-10-17 59 pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL);
bfed6708d6c974 Christoph Hellwig 2020-10-17 60 if (!pages)
be1cb55a07bfc5 Chris Wilson 2020-04-29 61 return NULL;
be1cb55a07bfc5 Chris Wilson 2020-04-29 62
bfed6708d6c974 Christoph Hellwig 2020-10-17 63 for (i = 0; i < n_pages; i++) {
bfed6708d6c974 Christoph Hellwig 2020-10-17 64 pages[i] = shmem_read_mapping_page_gfp(file->f_mapping, i,
be1cb55a07bfc5 Chris Wilson 2020-04-29 65 GFP_KERNEL);
bfed6708d6c974 Christoph Hellwig 2020-10-17 66 if (IS_ERR(pages[i]))
be1cb55a07bfc5 Chris Wilson 2020-04-29 67 goto err_page;
be1cb55a07bfc5 Chris Wilson 2020-04-29 68 }
be1cb55a07bfc5 Chris Wilson 2020-04-29 69
bfed6708d6c974 Christoph Hellwig 2020-10-17 70 vaddr = vmap(pages, n_pages, VM_MAP_PUT_PAGES, PAGE_KERNEL);
bfed6708d6c974 Christoph Hellwig 2020-10-17 71 if (!vaddr)
bfed6708d6c974 Christoph Hellwig 2020-10-17 72 goto err_page;
be1cb55a07bfc5 Chris Wilson 2020-04-29 73 mapping_set_unevictable(file->f_mapping);
bfed6708d6c974 Christoph Hellwig 2020-10-17 74 return vaddr;
be1cb55a07bfc5 Chris Wilson 2020-04-29 75 err_page:
bfed6708d6c974 Christoph Hellwig 2020-10-17 @76 while (--i >= 0)
bfed6708d6c974 Christoph Hellwig 2020-10-17 77 put_page(pages[i]);
bfed6708d6c974 Christoph Hellwig 2020-10-17 78 kvfree(pages);
be1cb55a07bfc5 Chris Wilson 2020-04-29 79 return NULL;
be1cb55a07bfc5 Chris Wilson 2020-04-29 80 }
be1cb55a07bfc5 Chris Wilson 2020-04-29 81
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
reply other threads:[~2020-10-28 16: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=202010290000.pgXQ1LCb-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/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.