]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: warning about unused-but-set parameter
authorArnd Bergmann <arnd@arndb.de>
Tue, 19 Oct 2021 15:34:53 +0000 (17:34 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 19 Oct 2021 15:50:18 +0000 (09:50 -0600)
commit7b71b5b88c0a1fac6b8cb9eff3783829eaf66653
tree83ae4bdb1ab4a5d3b4c73209a494d66fc359c64f
parent170c9901c4dfea0d3eee70b574bdde66f9398ec9
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: 950395003c1d ("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>
fs/io_uring.c