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
@@ -584,7 +584,7 @@ get_key_material_https(libzfs_handle_t *hdl, const char *uri,
goto end;
}
int kfd = -1;
int kfd;
#ifdef O_TMPFILE
kfd = open(getenv("TMPDIR") ?: "/tmp",
O_RDWR | O_TMPFILE | O_EXCL | O_CLOEXEC, 0600);
+2 -2
View File
@@ -896,7 +896,7 @@ int
zpool_set_prop(zpool_handle_t *zhp, const char *propname, const char *propval)
{
zfs_cmd_t zc = {"\0"};
int ret = -1;
int ret;
char errbuf[ERRBUFLEN];
nvlist_t *nvl = NULL;
nvlist_t *realprops;
@@ -4310,7 +4310,7 @@ zpool_set_guid(zpool_handle_t *zhp, const uint64_t *guid)
libzfs_handle_t *hdl = zhp->zpool_hdl;
nvlist_t *nvl = NULL;
zfs_cmd_t zc = {"\0"};
int error = -1;
int error;
if (guid != NULL) {
if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0)