io_uring: warning about unused-but-set parameter

When enabling -Wunused warnings by building with W=1, I get an
instance of the -Wunused-but-set-parameter warning in the io_uring code:

fs/io_uring.c: In function 'io_queue_async_work':
fs/io_uring.c:1445:61: error: parameter 'locked' set but not used [-Werror=unused-but-set-parameter]
 1445 | static void io_queue_async_work(struct io_kiocb *req, bool *locked)
      |                                                       ~~~~~~^~~~~~

There are very few warnings of this type, so it would be nice to enable
this by default and fix all the existing instances. As the assignment
serves no purpose by itself other than to prevent developers from using
the variable, an easy workaround is to remove the assignment and just
rename the argument to "dont_use".

Fixes: f237c30a56 ("io_uring: batch task work locking")
Link: https://lore.kernel.org/lkml/20210920121352.93063-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20211019153507.348480-1-arnd@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Arnd Bergmann 2021-10-19 17:34:53 +02:00 committed by Jens Axboe
parent 5ca7a8b3f6
commit 00169246e6
1 changed files with 1 additions and 4 deletions

View File

@ -1487,15 +1487,12 @@ static inline void io_req_add_compl_list(struct io_kiocb *req)
wq_list_add_tail(&req->comp_list, &state->compl_reqs);
}
static void io_queue_async_work(struct io_kiocb *req, bool *locked)
static void io_queue_async_work(struct io_kiocb *req, bool *dont_use)
{
struct io_ring_ctx *ctx = req->ctx;
struct io_kiocb *link = io_prep_linked_timeout(req);
struct io_uring_task *tctx = req->task->io_uring;
/* must not take the lock, NULL it as a precaution */
locked = NULL;
BUG_ON(!tctx);
BUG_ON(!tctx->io_wq);