Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: fix warnings on shadow variables

There are a few of those:

io_uring/fdinfo.c:170:16: warning: declaration shadows a local variable [-Wshadow]
170 | struct file *f = io_file_from_index(&ctx->file_table, i);
| ^
io_uring/fdinfo.c:53:67: note: previous declaration is here
53 | __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f)
| ^
io_uring/cancel.c:187:25: warning: declaration shadows a local variable [-Wshadow]
187 | struct io_uring_task *tctx = node->task->io_uring;
| ^
io_uring/cancel.c:166:31: note: previous declaration is here
166 | struct io_uring_task *tctx,
| ^
io_uring/register.c:371:25: warning: declaration shadows a local variable [-Wshadow]
371 | struct io_uring_task *tctx = node->task->io_uring;
| ^
io_uring/register.c:312:24: note: previous declaration is here
312 | struct io_uring_task *tctx = NULL;
| ^

and a simple cleanup gets rid of them. For the fdinfo case, make a
distinction between the file being passed in (for the ring), and the
registered files we iterate. For the other two cases, just get rid of
shadowed variable, there's no reason to have a new one.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+4 -7
+1 -3
io_uring/cancel.c
··· 184 184 io_ring_submit_lock(ctx, issue_flags); 185 185 ret = -ENOENT; 186 186 list_for_each_entry(node, &ctx->tctx_list, ctx_node) { 187 - struct io_uring_task *tctx = node->task->io_uring; 188 - 189 - ret = io_async_cancel_one(tctx, cd); 187 + ret = io_async_cancel_one(node->task->io_uring, cd); 190 188 if (ret != -ENOENT) { 191 189 if (!all) 192 190 break;
+2 -2
io_uring/fdinfo.c
··· 50 50 * Caller holds a reference to the file already, we don't need to do 51 51 * anything else to get an extra reference. 52 52 */ 53 - __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f) 53 + __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file) 54 54 { 55 - struct io_ring_ctx *ctx = f->private_data; 55 + struct io_ring_ctx *ctx = file->private_data; 56 56 struct io_overflow_cqe *ocqe; 57 57 struct io_rings *r = ctx->rings; 58 58 struct rusage sq_usage;
+1 -2
io_uring/register.c
··· 368 368 369 369 /* now propagate the restriction to all registered users */ 370 370 list_for_each_entry(node, &ctx->tctx_list, ctx_node) { 371 - struct io_uring_task *tctx = node->task->io_uring; 372 - 371 + tctx = node->task->io_uring; 373 372 if (WARN_ON_ONCE(!tctx->io_wq)) 374 373 continue; 375 374