Skip to contentSkip to conversation

io_uring/io_uring.c:1656:6: warning: variable 'nr' set but not used

PATCH kernel test robot 2 participants 2 messages May 9, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.16/io_uring
head:   55c28f431651973385c17081bdcdadf8b5c6da91
commit: 55c28f431651973385c17081bdcdadf8b5c6da91 [40/40] io_uring: drain based on allocates reqs
config: s390-randconfig-002-20250510 (https://download.01.org/0day-ci/archive/20250510/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250510/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> io_uring/io_uring.c:1656:6: warning: variable 'nr' set but not used [-Wunused-but-set-variable]
    1656 |         int nr = 0;
         |             ^

1 warning generated.

vim +/nr +1656 io_uring/io_uring.c

1648
1649 static __cold void io_drain_req(struct io_kiocb *req)
1650 __must_hold(&ctx->uring_lock)
1651 {
1652 struct io_ring_ctx *ctx = req->ctx;
1653 bool drain = req->flags & IOSQE_IO_DRAIN;
1654 struct io_defer_entry *de;
1655 struct io_kiocb *tmp;

> 1656		int nr = 0;

1657
1658 de = kmalloc(sizeof(*de), GFP_KERNEL_ACCOUNT);
1659 if (!de) {
1660 io_req_defer_failed(req, -ENOMEM);
1661 return;
1662 }
1663
1664 io_for_each_link(tmp, req)
1665 nr++;
1666 io_prep_async_link(req);
1667 trace_io_uring_defer(req);
1668 de->req = req;
1669
1670 ctx->nr_drained += io_linked_nr(req);
1671 list_add_tail(&de->list, &ctx->defer_list);
1672 io_queue_deferred(ctx);
1673 if (!drain && list_empty(&ctx->defer_list))
1674 ctx->drain_active = false;
1675 }
1676

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 12 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.16/io_uring
head:   55c28f431651973385c17081bdcdadf8b5c6da91
commit: 55c28f431651973385c17081bdcdadf8b5c6da91 [40/40] io_uring: drain based on allocates reqs
config: s390-randconfig-002-20250510 (https://download.01.org/0day-ci/archive/20250510/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250510/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 4 lines

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

io_uring/io_uring.c:1656:6: warning: variable 'nr' set but not used [-Wunused-but-set-variable]

     1656 |         int nr = 0;

It'a dead code that was replaced with a helper, I'll send the change

Signature · 1 line
Pavel Begunkov