]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
[clang-tidy] do not return in void functions
authorRosen Penev <rosenp@gmail.com>
Sun, 19 Apr 2020 04:23:13 +0000 (21:23 -0700)
committerRosen Penev <rosenp@gmail.com>
Sun, 19 Apr 2020 21:03:21 +0000 (14:03 -0700)
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
17 files changed:
disk-utils/fsck.c
disk-utils/fsck.minix.c
lib/idcache.c
lib/randutils.c
libblkid/src/devname.c
libblkid/src/devno.c
libblkid/src/probe.c
libblkid/src/read.c
login-utils/chfn.c
login-utils/lslogins.c
misc-utils/kill.c
misc-utils/whereis.c
sys-utils/ipcs.c
sys-utils/ldattach.c
sys-utils/swapon.c
term-utils/setterm.c
text-utils/hexdump-display.c

index be25f9c95ff7112b9f72b1fcf0865672835491bd..a071c0eb498690fc9cb7747ea41eb56ad1ca13fb 100644 (file)
@@ -398,7 +398,6 @@ done:
                inst->lockpath = NULL;
        }
        free(diskpath);
-       return;
 }
 
 static void unlock_disk(struct fsck_instance *inst)
@@ -425,7 +424,6 @@ static void free_instance(struct fsck_instance *i)
        free(i->lockpath);
        mnt_unref_fs(i->fs);
        free(i);
-       return;
 }
 
 static struct libmnt_fs *add_dummy_fs(const char *device)
index 246f254f3be6c7ccd2fd72ffb05b116015d3518f..53879895da06199e4475108c8a1051cc7e6c5e77 100644 (file)
@@ -293,7 +293,6 @@ check_mount(void) {
                printf(_("check aborted.\n"));
                exit(FSCK_EX_OK);
        }
-       return;
 }
 
 
@@ -511,7 +510,6 @@ write_super_block(void) {
                die(_("seek failed in write_super_block"));
        if (MINIX_BLOCK_SIZE != write(device_fd, super_block_buffer, MINIX_BLOCK_SIZE))
                die(_("unable to write super-block"));
-       return;
 }
 
 static void
@@ -1017,7 +1015,6 @@ check_file(struct minix_inode *dir, unsigned int offset) {
        if (inode && S_ISDIR(inode->i_mode))
                recursive_check(ino);
        name_depth--;
-       return;
 }
 
 static void
@@ -1087,7 +1084,6 @@ check_file2(struct minix2_inode *dir, unsigned int offset) {
        if (inode && S_ISDIR(inode->i_mode))
                recursive_check2(ino);
        name_depth--;
-       return;
 }
 
 static void
index 121992ce6a14dd6d67a3ad54b2b21dcd2bc82050..55502238d7b6daea0f67d2dfe32ef1c3a654a763 100644 (file)
@@ -93,7 +93,6 @@ static void add_id(struct idcache *ic, char *name, unsigned long int id)
        if (w <= 0)
                w = ent->name ? strlen(ent->name) : 0;
        ic->width = ic->width < w ? w : ic->width;
-       return;
 }
 
 void add_uid(struct idcache *cache, unsigned long int id)
index 01a3d09036798a858550950ace425b52171241d0..ce476f8a73d116458056dda4e90b31a314374e07 100644 (file)
@@ -177,7 +177,6 @@ void random_get_bytes(void *buf, size_t nbytes)
                       sizeof(ul_jrand_seed)-sizeof(unsigned short));
        }
 #endif
-       return;
 }
 
 
index bb0211da403b23f554d55a556d6dd42693d89eba..3a0f8aba61ec98e94e949475eaf1d68215df4001 100644 (file)
@@ -267,7 +267,6 @@ set_pri:
                if (removable)
                        dev->bid_flags |= BLKID_BID_FL_REMOVABLE;
        }
-       return;
 }
 
 #define PROC_PARTITIONS "/proc/partitions"
index 8882cddad8818d9862721d49fff80ac3319bfacd..8314a41c8905f99db483f5efbae296efe04184a9 100644 (file)
@@ -161,7 +161,6 @@ void blkid__scan_dir(char *dirname, dev_t devno, struct dir_list **list,
                add_to_dirlist(dirname, dp->d_name, list);
        }
        closedir(dir);
-       return;
 }
 
 /* Directories where we will try to search for device numbers */
index a8c2d3b4da309a341c886fe03f4a9a914db1977b..faf3596e6d86dbcb59ff3ded86163c0d5f401f16 100644 (file)
@@ -1998,7 +1998,6 @@ void blkid_probe_set_wiper(blkid_probe pr, uint64_t off, uint64_t size)
                        chn->driver->name,
                        chn->driver->idinfos[chn->idx]->name,
                        pr->wipe_off, pr->wipe_size));
-       return;
 }
 
 /*
index 5772b52fe095a5dc1b0107c9198a7d26bc7e43a6..c3b41be7656263beeaafa405d55035ee23961ac0 100644 (file)
@@ -420,7 +420,6 @@ void blkid_read_cache(blkid_cache cache)
        return;
 errout:
        close(fd);
-       return;
 }
 
 #ifdef TEST_PROGRAM
index b7395552bba90578fc74bf704f9b0d263ac6d30d..1b203a83ed4ca5a2aaedc04330aea573126cd19f 100644 (file)
@@ -195,7 +195,6 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv)
                }
                ctl->username = argv[optind];
        }
-       return;
 }
 
 /*
@@ -310,7 +309,6 @@ static void get_login_defs(struct chfn_control *ctl)
                warnx(_("%s: CHFN_RESTRICT has unexpected value: %s"), _PATH_LOGINDEFS, s);
        if (!ctl->allow_fullname && !ctl->allow_room && !ctl->allow_work && !ctl->allow_home)
                errx(EXIT_FAILURE, _("%s: CHFN_RESTRICT does not allow any changes"), _PATH_LOGINDEFS);
-       return;
 }
 
 /*
index 6fd0f96740e0d1c5a0d6aefa16f0222c70cf5c83..8a6ef713fa482f7d014e1dd98ca0f1e69bbd0334 100644 (file)
@@ -1225,7 +1225,6 @@ static void fill_table(const void *u, const VISIT which, const int depth __attri
                        err(EXIT_FAILURE, _("failed to add output data"));
                ++n;
        }
-       return;
 }
 #ifdef HAVE_LIBSYSTEMD
 static void print_journal_tail(const char *journal_path, uid_t uid, size_t len, int time_mode)
index 44d761b4fdaa8800aa8fafd7e9603ebaf0272b45..19182b4a319354ebfc177528ace6f1e47ea5fafe 100644 (file)
@@ -370,7 +370,6 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
                ctl->do_kill = 1;
                if (ctl->do_pid)
                        errx(EXIT_FAILURE, _("%s and %s are mutually exclusive"), "--pid", "--signal");
-               continue;
        }
        if (!*argv)
                errx(EXIT_FAILURE, _("not enough arguments"));
index 48361f5981998a1f2913c4434f4ed6242a078c3e..7a28a2c3567518675cf0cb40345c049ed9b46f5c 100644 (file)
@@ -254,7 +254,6 @@ static void dirlist_add_dir(struct wh_dirlist **ls0, int type, const char *dir)
        }
 
        DBG(LIST, ul_debugobj(*ls0, "  add dir: %s", ls->path));
-       return;
 }
 
 /* special case for '*' in the paths */
@@ -324,7 +323,6 @@ static void construct_dirlist_from_env(const char *env,
                dirlist_add_dir(ls, type, tok);
 
        free(pathcp);
-       return;
 }
 
 static void construct_dirlist_from_argv(struct wh_dirlist **ls,
@@ -346,8 +344,6 @@ static void construct_dirlist_from_argv(struct wh_dirlist **ls,
                dirlist_add_dir(ls, type, argv[i]);
                *idx = i;
        }
-
-       return;
 }
 
 static void construct_dirlist(struct wh_dirlist **ls,
@@ -365,7 +361,6 @@ static void construct_dirlist(struct wh_dirlist **ls,
                else
                        dirlist_add_subdir(ls, type, paths[i]);
        }
-       return;
 }
 
 static void free_dirlist(struct wh_dirlist **ls0, int type)
@@ -392,8 +387,6 @@ static void free_dirlist(struct wh_dirlist **ls0, int type)
                        ls = ls->next;
                }
        }
-
-       return;
 }
 
 
@@ -456,7 +449,6 @@ static void findin(const char *dir, const char *pattern, int *count, char **wait
                ++(*count);
        }
        closedir(dirp);
-       return;
 }
 
 static void lookup(const char *pattern, struct wh_dirlist *ls, int want)
@@ -492,7 +484,6 @@ static void lookup(const char *pattern, struct wh_dirlist *ls, int want)
 
        if (!uflag || count > 1)
                putchar('\n');
-       return;
 }
 
 static void list_dirlist(struct wh_dirlist *ls)
index 5fc96d7976c84078d1338287916efa7259751a67..fc6fba4a61de19e37cdb6b34b4c71ecc7da951a6 100644 (file)
@@ -353,7 +353,6 @@ static void do_shm (char format, int unit)
        }
 
        ipc_shm_free_info(shmds);
-       return;
 }
 
 static void do_sem (char format)
@@ -455,7 +454,6 @@ static void do_sem (char format)
        }
 
        ipc_sem_free_info(semds);
-       return;
 }
 
 static void do_msg (char format, int unit)
@@ -576,7 +574,6 @@ static void do_msg (char format, int unit)
        }
 
        ipc_msg_free_info(msgds);
-       return;
 }
 
 static void print_shm(int shmid, int unit)
index c2d2f8397a86003d1fd90b29ec117563581518d2..baf7cd512a125cc62d7bc3ebc868797096ceb658 100644 (file)
@@ -147,7 +147,6 @@ static void dbg(char *fmt, ...)
 #endif
        va_end(args);
        fflush(NULL);
-       return;
 }
 
 static int lookup_table(const struct ld_table *tab, const char *str)
index 7e3135c729f3bac50f36b3a91d0a9eb692f9e293..95b678a6b85b294652a2699360a08b4048c9f89b 100644 (file)
@@ -228,7 +228,6 @@ static void add_scols_line(const struct swapon_ctl *ctl, struct libscols_table *
        }
        if (pr)
                blkid_free_probe(pr);
-       return;
 }
 
 static int display_summary(void)
index 7b7c2ea6f41053c35a72f5dda17c7bfe89fcb97f..456abc59e95ddc91ac938a7139bd9c8931a64c48 100644 (file)
@@ -779,7 +779,6 @@ static void set_blanking(struct setterm_control *ctl)
        default:                /* should be impossible to reach */
                abort();
        }
-       return;
 }
 
 static void screendump(struct setterm_control *ctl)
@@ -833,7 +832,6 @@ static void screendump(struct setterm_control *ctl)
        free(ctl->in_device);
        if (close_stream(out) != 0)
                errx(EXIT_FAILURE, _("write error"));
-       return;
 }
 
 /* Some options are applicable when terminal is virtual console. */
index 3e017635b45f76b7d6fefaec35fd29e7870a6db0..6399608c0cc6287d64bb9ab37d7738030c265c73 100644 (file)
@@ -100,7 +100,6 @@ static const char *color_cond(struct hexdump_pr *pr, unsigned char *bp, int bcnt
                /* return the format string or check for another */
                if (match ^ clr->invert)
                        return clr->fmt;
-               continue;
        }
 
        /* no match */