152 lines
3.8 KiB
Diff
152 lines
3.8 KiB
Diff
|
From 2c3cbb5713e86199a10c8624eaf188609635d443 Mon Sep 17 00:00:00 2001
|
||
|
From: Rosen Penev <rosenp@gmail.com>
|
||
|
Date: Mon, 1 Apr 2024 14:11:56 -0700
|
||
|
Subject: [PATCH 17/44] clang-tidy: don't use else after return
|
||
|
|
||
|
Found with readability-else-after-return
|
||
|
|
||
|
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||
|
---
|
||
|
bitmap.h | 15 +++++----------
|
||
|
classify.c | 6 ++----
|
||
|
irqbalance.c | 6 +++---
|
||
|
numa.c | 2 +-
|
||
|
ui/ui.c | 13 ++++++-------
|
||
|
5 files changed, 17 insertions(+), 25 deletions(-)
|
||
|
|
||
|
diff --git a/bitmap.h b/bitmap.h
|
||
|
index 7afce59..9eca1af 100644
|
||
|
--- a/bitmap.h
|
||
|
+++ b/bitmap.h
|
||
|
@@ -282,8 +282,7 @@ static inline int bitmap_equal(const unsigned long *src1,
|
||
|
{
|
||
|
if (nbits <= BITS_PER_LONG)
|
||
|
return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
|
||
|
- else
|
||
|
- return __bitmap_equal(src1, src2, nbits);
|
||
|
+ return __bitmap_equal(src1, src2, nbits);
|
||
|
}
|
||
|
|
||
|
static inline int bitmap_intersects(const unsigned long *src1,
|
||
|
@@ -291,8 +290,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
|
||
|
{
|
||
|
if (nbits <= BITS_PER_LONG)
|
||
|
return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
|
||
|
- else
|
||
|
- return __bitmap_intersects(src1, src2, nbits);
|
||
|
+ return __bitmap_intersects(src1, src2, nbits);
|
||
|
}
|
||
|
|
||
|
static inline int bitmap_subset(const unsigned long *src1,
|
||
|
@@ -300,24 +298,21 @@ static inline int bitmap_subset(const unsigned long *src1,
|
||
|
{
|
||
|
if (nbits <= BITS_PER_LONG)
|
||
|
return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
|
||
|
- else
|
||
|
- return __bitmap_subset(src1, src2, nbits);
|
||
|
+ return __bitmap_subset(src1, src2, nbits);
|
||
|
}
|
||
|
|
||
|
static inline int bitmap_empty(const unsigned long *src, int nbits)
|
||
|
{
|
||
|
if (nbits <= BITS_PER_LONG)
|
||
|
return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
|
||
|
- else
|
||
|
- return __bitmap_empty(src, nbits);
|
||
|
+ return __bitmap_empty(src, nbits);
|
||
|
}
|
||
|
|
||
|
static inline int bitmap_full(const unsigned long *src, int nbits)
|
||
|
{
|
||
|
if (nbits <= BITS_PER_LONG)
|
||
|
return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
|
||
|
- else
|
||
|
- return __bitmap_full(src, nbits);
|
||
|
+ return __bitmap_full(src, nbits);
|
||
|
}
|
||
|
|
||
|
static inline int bitmap_weight(const unsigned long *src, int nbits)
|
||
|
diff --git a/classify.c b/classify.c
|
||
|
index df9c13c..cc0200d 100644
|
||
|
--- a/classify.c
|
||
|
+++ b/classify.c
|
||
|
@@ -295,8 +295,7 @@ gint substr_find(gconstpointer a, gconstpointer b)
|
||
|
{
|
||
|
if (strstr(b, a))
|
||
|
return 0;
|
||
|
- else
|
||
|
- return 1;
|
||
|
+ return 1;
|
||
|
}
|
||
|
|
||
|
static void add_banned_module(char *modname, GList **modlist)
|
||
|
@@ -558,8 +557,7 @@ static int check_for_module_ban(char *name)
|
||
|
|
||
|
if (entry)
|
||
|
return 1;
|
||
|
- else
|
||
|
- return 0;
|
||
|
+ return 0;
|
||
|
}
|
||
|
|
||
|
static int check_for_irq_ban(struct irq_info *irq, char *mod)
|
||
|
diff --git a/irqbalance.c b/irqbalance.c
|
||
|
index a8c56c2..ab4e448 100644
|
||
|
--- a/irqbalance.c
|
||
|
+++ b/irqbalance.c
|
||
|
@@ -330,10 +330,10 @@ out:
|
||
|
|
||
|
if (keep_going) {
|
||
|
return TRUE;
|
||
|
- } else {
|
||
|
- g_main_loop_quit(main_loop);
|
||
|
- return FALSE;
|
||
|
}
|
||
|
+
|
||
|
+ g_main_loop_quit(main_loop);
|
||
|
+ return FALSE;
|
||
|
}
|
||
|
|
||
|
void get_irq_data(struct irq_info *irq, void *data)
|
||
|
diff --git a/numa.c b/numa.c
|
||
|
index 13d7ebd..5143ea0 100644
|
||
|
--- a/numa.c
|
||
|
+++ b/numa.c
|
||
|
@@ -116,7 +116,7 @@ void connect_cpu_mem_topo(struct topo_obj *p, void *data __attribute__((unused))
|
||
|
|
||
|
if (len == 0) {
|
||
|
return;
|
||
|
- } else if (len > 1) {
|
||
|
+ } if (len > 1) {
|
||
|
for_each_object(p->children, connect_cpu_mem_topo, NULL);
|
||
|
return;
|
||
|
}
|
||
|
diff --git a/ui/ui.c b/ui/ui.c
|
||
|
index 2695ef0..c580f85 100644
|
||
|
--- a/ui/ui.c
|
||
|
+++ b/ui/ui.c
|
||
|
@@ -113,14 +113,13 @@ int get_valid_sleep_input(int column_offest)
|
||
|
new_sleep = strtol(input, &error, 10);
|
||
|
if((*error == '\0') && (new_sleep >= 1)) {
|
||
|
break;
|
||
|
- } else {
|
||
|
- new_sleep = setup.sleep;
|
||
|
- attrset(COLOR_PAIR(4) | A_BOLD);
|
||
|
- mvprintw(LINES - 2, 1,
|
||
|
- "Invalid input: %s ",
|
||
|
- input);
|
||
|
- refresh();
|
||
|
}
|
||
|
+ new_sleep = setup.sleep;
|
||
|
+ attrset(COLOR_PAIR(4) | A_BOLD);
|
||
|
+ mvprintw(LINES - 2, 1,
|
||
|
+ "Invalid input: %s ",
|
||
|
+ input);
|
||
|
+ refresh();
|
||
|
free(input);
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.47.0
|
||
|
|