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, Dan Carpenter <error27@gmail.com>
Subject: [isilence:rw-dmabuf-v5 1/16] drivers/dma-buf/dma-buf-io.c:169 dma_buf_io_create_map() warn: inconsistent returns 'dmabuf->resv'.
Date: Mon, 03 Aug 2026 06:26:10 +0800	[thread overview]
Message-ID: <202608030631.jIkiKCzz-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Pavel Begunkov <asml.silence@gmail.com>

tree:   https://github.com/isilence/linux rw-dmabuf-v5
head:   71c75106fd3c8852b3856e472b586db82e480f7b
commit: ff5dccf71e8c03d62797352c4bb5fbb7c6c759c8 [1/16] dma-buf: introduce initial file I/O infrastructure
:::::: branch date: 31 hours ago
:::::: commit date: 31 hours ago
config: i386-randconfig-141-20260803 (https://download.01.org/0day-ci/archive/20260803/202608030631.jIkiKCzz-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608030631.jIkiKCzz-lkp@intel.com/

smatch warnings:
drivers/dma-buf/dma-buf-io.c:169 dma_buf_io_create_map() warn: inconsistent returns 'dmabuf->resv'.

vim +169 drivers/dma-buf/dma-buf-io.c

ff5dccf71e8c03 Pavel Begunkov 2026-04-19  118  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  119  struct dma_buf_io_map *dma_buf_io_create_map(struct dma_buf_io_ctx *ctx)
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  120  {
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  121  	struct dma_buf *dmabuf = ctx->dmabuf;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  122  	struct dma_buf_io_map *map;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  123  	long ret;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  124  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  125  retry:
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  126  	/*
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  127  	 * ->dmabuf_map() will be calling dma_buf_map_attachment(), for which
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  128  	 * we'll need to wait for fences. Do a bit nicer and try to wait
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  129  	 * without the resv lock first.
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  130  	 */
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  131  	ret = dma_resv_wait_timeout(dmabuf->resv, DMA_RESV_USAGE_KERNEL,
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  132  				    true, MAX_SCHEDULE_TIMEOUT);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  133  	if (!ret)
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  134  		ret = -EAGAIN;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  135  	if (ret < 0)
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  136  		return ERR_PTR(ret);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  137  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  138  	ret = dma_resv_lock_interruptible(dmabuf->resv, NULL);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  139  	if (ret)
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  140  		return ERR_PTR(ret);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  141  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  142  	map = dma_buf_io_get_map(ctx);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  143  	if (map) {
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  144  		ret = 0;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  145  		goto out;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  146  	}
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  147  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  148  	if (dma_resv_wait_timeout(dmabuf->resv, DMA_RESV_USAGE_KERNEL,
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  149  				  true, 0) < 0) {
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  150  		dma_resv_unlock(dmabuf->resv);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  151  		goto retry;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  152  	}
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  153  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  154  	map = ctx->dev_ops->map(ctx);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  155  	if (IS_ERR(map)) {
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  156  		ret = PTR_ERR(map);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  157  		goto out;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  158  	}
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  159  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  160  	if (WARN_ON_ONCE(!map->seg_shift))
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  161  		return ERR_PTR(-EFAULT);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  162  
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  163  	percpu_ref_get(&map->refs);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  164  	rcu_assign_pointer(ctx->map, map);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  165  out:
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  166  	dma_resv_unlock(dmabuf->resv);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  167  	if (ret < 0)
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  168  		return ERR_PTR(ret);
ff5dccf71e8c03 Pavel Begunkov 2026-04-19 @169  	return map;
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  170  }
ff5dccf71e8c03 Pavel Begunkov 2026-04-19  171  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-08-02 22:27 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=202608030631.jIkiKCzz-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.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.