batman-adv: Remove unnecessary ret variable
We can avoid this indirect return variable by directly returning the error values. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
This commit is contained in:
parent
f2d5cf2add
commit
9fb6c6519b
|
@ -513,14 +513,12 @@ static struct batadv_algo_ops *batadv_algo_get(char *name)
|
||||||
int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
|
int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
|
||||||
{
|
{
|
||||||
struct batadv_algo_ops *bat_algo_ops_tmp;
|
struct batadv_algo_ops *bat_algo_ops_tmp;
|
||||||
int ret;
|
|
||||||
|
|
||||||
bat_algo_ops_tmp = batadv_algo_get(bat_algo_ops->name);
|
bat_algo_ops_tmp = batadv_algo_get(bat_algo_ops->name);
|
||||||
if (bat_algo_ops_tmp) {
|
if (bat_algo_ops_tmp) {
|
||||||
pr_info("Trying to register already registered routing algorithm: %s\n",
|
pr_info("Trying to register already registered routing algorithm: %s\n",
|
||||||
bat_algo_ops->name);
|
bat_algo_ops->name);
|
||||||
ret = -EEXIST;
|
return -EEXIST;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all algorithms must implement all ops (for now) */
|
/* all algorithms must implement all ops (for now) */
|
||||||
|
@ -534,16 +532,13 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
|
||||||
!bat_algo_ops->bat_neigh_is_equiv_or_better) {
|
!bat_algo_ops->bat_neigh_is_equiv_or_better) {
|
||||||
pr_info("Routing algo '%s' does not implement required ops\n",
|
pr_info("Routing algo '%s' does not implement required ops\n",
|
||||||
bat_algo_ops->name);
|
bat_algo_ops->name);
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_HLIST_NODE(&bat_algo_ops->list);
|
INIT_HLIST_NODE(&bat_algo_ops->list);
|
||||||
hlist_add_head(&bat_algo_ops->list, &batadv_algo_list);
|
hlist_add_head(&bat_algo_ops->list, &batadv_algo_list);
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
|
int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
|
||||||
|
|
Loading…
Reference in New Issue