io_uring: Fix use of uninitialized ret in io_eventfd_register()
authorNathan Chancellor <nathan@kernel.org>
Mon, 7 Feb 2022 16:24:11 +0000 (09:24 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Feb 2022 13:57:35 +0000 (06:57 -0700)
commit4c65723081332607ca331072b0f8a90189e2e447
tree8e4bda55ae8d3e5616f373215669317bab3fa2a0
parent88a0394bc27de2dd8a8715970f289c5627052532
io_uring: Fix use of uninitialized ret in io_eventfd_register()

Clang warns:

  fs/io_uring.c:9396:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
          return ret;
                 ^~~
  fs/io_uring.c:9373:13: note: initialize the variable 'ret' to silence this warning
          int fd, ret;
                     ^
                      = 0
  1 warning generated.

Just return 0 directly and reduce the scope of ret to the if statement,
as that is the only place that it is used, which is how the function was
before the fixes commit.

Fixes: 1a75fac9a0f9 ("io_uring: avoid ring quiesce while registering/unregistering eventfd")
Link: https://github.com/ClangBuiltLinux/linux/issues/1579
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20220207162410.1013466-1-nathan@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c