[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231020011856.3244410-7-kuba@kernel.org>
Date: Thu, 19 Oct 2023 18:18:56 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
johannes.berg@...el.com,
mpe@...erman.id.au,
j@...fi,
jiri@...nulli.us
Subject: [PATCH net-next 6/6] net: remove else after return in dev_prep_valid_name()
Remove unnecessary else clauses after return.
I copied this if / else construct from somewhere,
it makes the code harder to read.
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
net/core/dev.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 0830f2967221..a37a932a3e14 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1131,14 +1131,13 @@ static int dev_prep_valid_name(struct net *net, struct net_device *dev,
if (!dev_valid_name(want_name))
return -EINVAL;
- if (strchr(want_name, '%')) {
+ if (strchr(want_name, '%'))
return __dev_alloc_name(net, want_name, out_name);
- } else if (netdev_name_in_use(net, want_name)) {
- return -dup_errno;
- } else if (out_name != want_name) {
- strscpy(out_name, want_name, IFNAMSIZ);
- }
+ if (netdev_name_in_use(net, want_name))
+ return -dup_errno;
+ if (out_name != want_name)
+ strscpy(out_name, want_name, IFNAMSIZ);
return 0;
}
--
2.41.0
Powered by blists - more mailing lists