From bd89499e07a85b399a345e319e61d0afc5f3088c Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 18 Apr 2020 21:23:13 -0700 Subject: [PATCH] [clang-tidy] do not return in void functions Found with readability-redundant-control-flow Signed-off-by: Rosen Penev --- disk-utils/fsck.c | 2 -- disk-utils/fsck.minix.c | 4 ---- lib/idcache.c | 1 - lib/randutils.c | 1 - libblkid/src/devname.c | 1 - libblkid/src/devno.c | 1 - libblkid/src/probe.c | 1 - libblkid/src/read.c | 1 - login-utils/chfn.c | 2 -- login-utils/lslogins.c | 1 - misc-utils/kill.c | 1 - misc-utils/whereis.c | 9 --------- sys-utils/ipcs.c | 3 --- sys-utils/ldattach.c | 1 - sys-utils/swapon.c | 1 - term-utils/setterm.c | 2 -- text-utils/hexdump-display.c | 1 - 17 files changed, 33 deletions(-) diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c index be25f9c95..a071c0eb4 100644 --- a/disk-utils/fsck.c +++ b/disk-utils/fsck.c @@ -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) diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c index 246f254f3..53879895d 100644 --- a/disk-utils/fsck.minix.c +++ b/disk-utils/fsck.minix.c @@ -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 diff --git a/lib/idcache.c b/lib/idcache.c index 121992ce6..55502238d 100644 --- a/lib/idcache.c +++ b/lib/idcache.c @@ -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) diff --git a/lib/randutils.c b/lib/randutils.c index 01a3d0903..ce476f8a7 100644 --- a/lib/randutils.c +++ b/lib/randutils.c @@ -177,7 +177,6 @@ void random_get_bytes(void *buf, size_t nbytes) sizeof(ul_jrand_seed)-sizeof(unsigned short)); } #endif - return; } diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c index bb0211da4..3a0f8aba6 100644 --- a/libblkid/src/devname.c +++ b/libblkid/src/devname.c @@ -267,7 +267,6 @@ set_pri: if (removable) dev->bid_flags |= BLKID_BID_FL_REMOVABLE; } - return; } #define PROC_PARTITIONS "/proc/partitions" diff --git a/libblkid/src/devno.c b/libblkid/src/devno.c index 8882cddad..8314a41c8 100644 --- a/libblkid/src/devno.c +++ b/libblkid/src/devno.c @@ -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 */ diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index a8c2d3b4d..faf3596e6 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -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; } /* diff --git a/libblkid/src/read.c b/libblkid/src/read.c index 5772b52fe..c3b41be76 100644 --- a/libblkid/src/read.c +++ b/libblkid/src/read.c @@ -420,7 +420,6 @@ void blkid_read_cache(blkid_cache cache) return; errout: close(fd); - return; } #ifdef TEST_PROGRAM diff --git a/login-utils/chfn.c b/login-utils/chfn.c index b7395552b..1b203a83e 100644 --- a/login-utils/chfn.c +++ b/login-utils/chfn.c @@ -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; } /* diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c index 6fd0f9674..8a6ef713f 100644 --- a/login-utils/lslogins.c +++ b/login-utils/lslogins.c @@ -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) diff --git a/misc-utils/kill.c b/misc-utils/kill.c index 44d761b4f..19182b4a3 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -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")); diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c index 48361f598..7a28a2c35 100644 --- a/misc-utils/whereis.c +++ b/misc-utils/whereis.c @@ -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) diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 5fc96d797..fc6fba4a6 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -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) diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c index c2d2f8397..baf7cd512 100644 --- a/sys-utils/ldattach.c +++ b/sys-utils/ldattach.c @@ -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) diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 7e3135c72..95b678a6b 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -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) diff --git a/term-utils/setterm.c b/term-utils/setterm.c index 7b7c2ea6f..456abc59e 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -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. */ diff --git a/text-utils/hexdump-display.c b/text-utils/hexdump-display.c index 3e017635b..6399608c0 100644 --- a/text-utils/hexdump-display.c +++ b/text-utils/hexdump-display.c @@ -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 */