everywhere: misc unnecessary var init/update

These are all cases where we initialise or update a variable, and then
never use it. None of them particularly matter, as the compiler should
optimise them all away during dead store elimination, but some static
analysers complain about them and they are extra work for casual readers
to follow, so worth removing.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #17551
This commit is contained in:
Rob Norris
2025-06-27 12:56:03 +10:00
committed by Brian Behlendorf
parent d2b9e66b88
commit bf38c15071
17 changed files with 30 additions and 38 deletions
+1 -1
View File
@@ -301,7 +301,7 @@ static int
write_idmap(pid_t pid, char *buf, size_t buf_size, idmap_type_t type)
{
char path[PATH_MAX];
int fd = -EBADF;
int fd;
int ret;
(void) snprintf(path, sizeof (path), "/proc/%d/%cid_map",
+1 -1
View File
@@ -152,7 +152,7 @@ getfdname(char *pdir, char type, int level, int dir, int file)
static void
crtfile(char *pname)
{
int fd = -1;
int fd;
int i, size;
const char *context = "0123456789ABCDF";
char *pbuf;
+2 -2
View File
@@ -59,7 +59,7 @@ static void *
normal_writer(void *filename)
{
char *file_path = filename;
int fd = -1;
int fd;
ssize_t write_num = 0;
int page_size = getpagesize();
@@ -93,7 +93,7 @@ normal_writer(void *filename)
static void *
map_writer(void *filename)
{
int fd = -1;
int fd;
int ret = 0;
char *buf = NULL;
int page_size = getpagesize();