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.

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20231023152346.3639749-7-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2023-10-23 08:23:46 -07:00
parent 70e1b14c1b
commit ce4cfa2318

View File

@ -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;
}