batman-adv: Remove unnecessary ret variable
authorMarkus Pargmann <mpa@pengutronix.de>
Fri, 26 Dec 2014 11:41:40 +0000 (12:41 +0100)
committerAntonio Quartulli <antonio@meshcoding.com>
Wed, 3 Jun 2015 13:57:24 +0000 (15:57 +0200)
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>
net/batman-adv/main.c

index a22247a61d3ef185741b8d6aa7793597f769d4f9..49f07e1e0f5fa17fa2f4e526b5c01240bcc51970 100644 (file)
@@ -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)
 {
        struct batadv_algo_ops *bat_algo_ops_tmp;
-       int ret;
 
        bat_algo_ops_tmp = batadv_algo_get(bat_algo_ops->name);
        if (bat_algo_ops_tmp) {
                pr_info("Trying to register already registered routing algorithm: %s\n",
                        bat_algo_ops->name);
-               ret = -EEXIST;
-               goto out;
+               return -EEXIST;
        }
 
        /* 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) {
                pr_info("Routing algo '%s' does not implement required ops\n",
                        bat_algo_ops->name);
-               ret = -EINVAL;
-               goto out;
+               return -EINVAL;
        }
 
        INIT_HLIST_NODE(&bat_algo_ops->list);
        hlist_add_head(&bat_algo_ops->list, &batadv_algo_list);
-       ret = 0;
 
-out:
-       return ret;
+       return 0;
 }
 
 int batadv_algo_select(struct batadv_priv *bat_priv, char *name)