batman-adv: Remove needless init of variables on stack
authorSven Eckelmann <sven@narfation.org>
Sun, 24 Jul 2016 22:42:44 +0000 (00:42 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Wed, 19 Oct 2016 06:37:52 +0000 (08:37 +0200)
Some variables are overwritten immediatelly in a functions. These don't
have to be initialized to a specific value on the stack because the value
will be overwritten before they will be used anywhere.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/bat_v.c
net/batman-adv/bat_v_ogm.c
net/batman-adv/fragmentation.c
net/batman-adv/gateway_client.c
net/batman-adv/originator.c
net/batman-adv/send.c

index e79f6f01182eb6731927aea1bc0cba553fb600ff..57c795c4c8cdb6842f982f1d3dc0c9b07c708f1c 100644 (file)
@@ -787,7 +787,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
                                    struct batadv_orig_node *curr_gw_orig,
                                    struct batadv_orig_node *orig_node)
 {
-       struct batadv_gw_node *curr_gw = NULL, *orig_gw = NULL;
+       struct batadv_gw_node *curr_gw, *orig_gw = NULL;
        u32 gw_throughput, orig_throughput, threshold;
        bool ret = false;
 
index 1aeeadca620cd090ce763ef017cb01f6a2ec2890..61ff5f82cfbf636971f9c26b4b228c6bd49a2b2a 100644 (file)
@@ -401,7 +401,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv,
                                      struct batadv_hard_iface *if_incoming,
                                      struct batadv_hard_iface *if_outgoing)
 {
-       struct batadv_orig_ifinfo *orig_ifinfo = NULL;
+       struct batadv_orig_ifinfo *orig_ifinfo;
        struct batadv_neigh_ifinfo *neigh_ifinfo = NULL;
        bool protection_started = false;
        int ret = -EINVAL;
@@ -486,7 +486,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
                                      struct batadv_hard_iface *if_outgoing)
 {
        struct batadv_neigh_node *router = NULL;
-       struct batadv_orig_node *orig_neigh_node = NULL;
+       struct batadv_orig_node *orig_neigh_node;
        struct batadv_neigh_node *orig_neigh_router = NULL;
        struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL;
        u32 router_throughput, neigh_throughput;
index 0934730fb7ffb539cd89dc29e3b7a8d9630c51b6..1b2f5b999b23b9c0a6558692cef12073c7c902c7 100644 (file)
@@ -252,7 +252,7 @@ batadv_frag_merge_packets(struct hlist_head *chain)
 {
        struct batadv_frag_packet *packet;
        struct batadv_frag_list_entry *entry;
-       struct sk_buff *skb_out = NULL;
+       struct sk_buff *skb_out;
        int size, hdr_size = sizeof(struct batadv_frag_packet);
 
        /* Remove first entry, as this is the destination for the rest of the
@@ -352,7 +352,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
                         struct batadv_orig_node *orig_node_src)
 {
        struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
-       struct batadv_orig_node *orig_node_dst = NULL;
+       struct batadv_orig_node *orig_node_dst;
        struct batadv_neigh_node *neigh_node = NULL;
        struct batadv_frag_packet *packet;
        u16 total_size;
index de055d64debe4b335627ad74aeba60d6b0e4f6f2..69bfe98b536085ca0809761f4966df25c8affa21 100644 (file)
@@ -704,7 +704,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
 {
        struct batadv_neigh_node *neigh_curr = NULL;
        struct batadv_neigh_node *neigh_old = NULL;
-       struct batadv_orig_node *orig_dst_node = NULL;
+       struct batadv_orig_node *orig_dst_node;
        struct batadv_gw_node *gw_node = NULL;
        struct batadv_gw_node *curr_gw = NULL;
        struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo;
index 5f3bfc41aeb1ca5e505a232a480ad5671d85265a..6af87c9494f232ea24053b8813bf6c55ea3ca137 100644 (file)
@@ -364,7 +364,7 @@ struct batadv_orig_ifinfo *
 batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
                       struct batadv_hard_iface *if_outgoing)
 {
-       struct batadv_orig_ifinfo *orig_ifinfo = NULL;
+       struct batadv_orig_ifinfo *orig_ifinfo;
        unsigned long reset_time;
 
        spin_lock_bh(&orig_node->neigh_list_lock);
@@ -520,7 +520,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
                           const u8 *neigh_addr)
 {
        struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
-       struct batadv_hardif_neigh_node *hardif_neigh = NULL;
+       struct batadv_hardif_neigh_node *hardif_neigh;
 
        spin_lock_bh(&hard_iface->neigh_list_lock);
 
@@ -563,7 +563,7 @@ static struct batadv_hardif_neigh_node *
 batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface,
                                  const u8 *neigh_addr)
 {
-       struct batadv_hardif_neigh_node *hardif_neigh = NULL;
+       struct batadv_hardif_neigh_node *hardif_neigh;
 
        /* first check without locking to avoid the overhead */
        hardif_neigh = batadv_hardif_neigh_get(hard_iface, neigh_addr);
@@ -683,7 +683,7 @@ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
                                struct batadv_hard_iface *hard_iface,
                                const u8 *neigh_addr)
 {
-       struct batadv_neigh_node *neigh_node = NULL;
+       struct batadv_neigh_node *neigh_node;
 
        /* first check without locking to avoid the overhead */
        neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
index 8d4e1f57857455ea5694ed7a8ef014a70cdee7b4..e1e9136db6e8823beb85ab94c8a21f7b3f78739f 100644 (file)
@@ -562,7 +562,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
                                    const struct sk_buff *skb,
                                    unsigned long delay)
 {
-       struct batadv_hard_iface *primary_if = NULL;
+       struct batadv_hard_iface *primary_if;
        struct batadv_forw_packet *forw_packet;
        struct batadv_bcast_packet *bcast_packet;
        struct sk_buff *newskb;