linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [linux-next:master 10147/11937] drivers/dma-buf/st-dma-resv.c:295:7: error: variable 'i' is used uninitialized whenever 'if' condition is true
Date: Wed, 27 Oct 2021 21:21:43 +0800	[thread overview]
Message-ID: <202110272138.ApXS8Rvi-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4275 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ae5179317e794160e471db0e122c6ac811a97235
commit: 1d51775cd3f51899ce85afab686c7f641ff32d4e [10147/11937] dma-buf: add dma_resv selftest v4
config: i386-buildonly-randconfig-r005-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=1d51775cd3f51899ce85afab686c7f641ff32d4e
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 1d51775cd3f51899ce85afab686c7f641ff32d4e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386 

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

All errors (new ones prefixed by >>):

>> drivers/dma-buf/st-dma-resv.c:295:7: error: variable 'i' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                   if (r) {
                       ^
   drivers/dma-buf/st-dma-resv.c:336:9: note: uninitialized use occurs here
           while (i--)
                  ^
   drivers/dma-buf/st-dma-resv.c:295:3: note: remove the 'if' if its condition is always false
                   if (r) {
                   ^~~~~~~~
   drivers/dma-buf/st-dma-resv.c:288:6: error: variable 'i' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
           if (r) {
               ^
   drivers/dma-buf/st-dma-resv.c:336:9: note: uninitialized use occurs here
           while (i--)
                  ^
   drivers/dma-buf/st-dma-resv.c:288:2: note: remove the 'if' if its condition is always false
           if (r) {
           ^~~~~~~~
   drivers/dma-buf/st-dma-resv.c:280:10: note: initialize the variable 'i' to silence this warning
           int r, i;
                   ^
                    = 0
   2 errors generated.


vim +295 drivers/dma-buf/st-dma-resv.c

   275	
   276	static int test_get_fences(void *arg, bool shared)
   277	{
   278		struct dma_fence *f, *excl = NULL, **fences = NULL;
   279		struct dma_resv resv;
   280		int r, i;
   281	
   282		f = alloc_fence();
   283		if (!f)
   284			return -ENOMEM;
   285	
   286		dma_resv_init(&resv);
   287		r = dma_resv_lock(&resv, NULL);
   288		if (r) {
   289			pr_err("Resv locking failed\n");
   290			goto err_free;
   291		}
   292	
   293		if (shared) {
   294			r = dma_resv_reserve_shared(&resv, 1);
 > 295			if (r) {
   296				pr_err("Resv shared slot allocation failed\n");
   297				dma_resv_unlock(&resv);
   298				goto err_free;
   299			}
   300	
   301			dma_resv_add_shared_fence(&resv, f);
   302		} else {
   303			dma_resv_add_excl_fence(&resv, f);
   304		}
   305		dma_resv_unlock(&resv);
   306	
   307		r = dma_resv_get_fences(&resv, &excl, &i, &fences);
   308		if (r) {
   309			pr_err("get_fences failed\n");
   310			goto err_free;
   311		}
   312	
   313		if (shared) {
   314			if (excl != NULL) {
   315				pr_err("get_fences returned unexpected excl fence\n");
   316				goto err_free;
   317			}
   318			if (i != 1 || fences[0] != f) {
   319				pr_err("get_fences returned unexpected shared fence\n");
   320				goto err_free;
   321			}
   322		} else {
   323			if (excl != f) {
   324				pr_err("get_fences returned unexpected excl fence\n");
   325				goto err_free;
   326			}
   327			if (i != 0) {
   328				pr_err("get_fences returned unexpected shared fence\n");
   329				goto err_free;
   330			}
   331		}
   332	
   333		dma_fence_signal(f);
   334	err_free:
   335		dma_fence_put(excl);
   336		while (i--)
   337			dma_fence_put(fences[i]);
   338		kfree(fences);
   339		dma_resv_fini(&resv);
   340		dma_fence_put(f);
   341		return r;
   342	}
   343	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40094 bytes --]

                 reply	other threads:[~2021-10-27 13:22 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=202110272138.ApXS8Rvi-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=tvrtko.ursulin@intel.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;
as well as URLs for NNTP newsgroup(s).