diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-03-09 17:51:13 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-03-09 18:10:58 +0100 |
commit | fa780334a8c392d959ae05eb19f2410b3a1e6cb0 (patch) | |
tree | cae12f065f6e323f3c82a252ea8aaef49f31abb5 /io_uring/slist.h | |
parent | io_uring/uring_cmd: ensure that device supports IOPOLL (diff) | |
download | linux-fa780334a8c392d959ae05eb19f2410b3a1e6cb0.tar.xz linux-fa780334a8c392d959ae05eb19f2410b3a1e6cb0.zip |
io_uring: silence variable ‘prev’ set but not used warning
If io_uring.o is built with W=1, it triggers a warning:
io_uring/io_uring.c: In function ‘__io_submit_flush_completions’:
io_uring/io_uring.c:1502:40: warning: variable ‘prev’ set but not used [-Wunused-but-set-variable]
1502 | struct io_wq_work_node *node, *prev;
| ^~~~
which is due to the wq_list_for_each() iterator always keeping a 'prev'
variable. Most users need this to remove an entry from a list, for
example, but __io_submit_flush_completions() never does that.
Add a basic helper that doesn't track prev instead, and use that in
that function.
Reported-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/slist.h')
-rw-r--r-- | io_uring/slist.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/io_uring/slist.h b/io_uring/slist.h index 7c198a40d5f1..0eb194817242 100644 --- a/io_uring/slist.h +++ b/io_uring/slist.h @@ -3,6 +3,9 @@ #include <linux/io_uring_types.h> +#define __wq_list_for_each(pos, head) \ + for (pos = (head)->first; pos; pos = (pos)->next) + #define wq_list_for_each(pos, prv, head) \ for (pos = (head)->first, prv = NULL; pos; prv = pos, pos = (pos)->next) @@ -113,4 +116,4 @@ static inline struct io_wq_work *wq_next_work(struct io_wq_work *work) return container_of(work->list.next, struct io_wq_work, list); } -#endif // INTERNAL_IO_SLIST_H
\ No newline at end of file +#endif // INTERNAL_IO_SLIST_H |