[2/4] batman-adv: silence uninitialized variable warning

Message ID 1385123427-15460-2-git-send-email-sw@simonwunderlich.de (mailing list archive)
State Accepted, archived
Commit aed390db25c837c3002925a468b4d32d9a2b3ecb
Headers

Commit Message

Simon Wunderlich Nov. 22, 2013, 12:30 p.m. UTC
  From: Simon Wunderlich <simon@open-mesh.com>

sparse (at least the version of the build checker) is complaining about:

routing.c: In function 'batadv_find_router':
routing.c:431:28: warning: 'next_candidate_router' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Although this is bogus, silencing is not expensive and is done by this
patch.

Introduced by 797edd9e87ac838711e03498a4ae795b600191af
("batman-adv: add bonding again")

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
---
 routing.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Marek Lindner Nov. 22, 2013, 5:28 p.m. UTC | #1
On Friday 22 November 2013 13:30:25 Simon Wunderlich wrote:
> From: Simon Wunderlich <simon@open-mesh.com>
> 
> sparse (at least the version of the build checker) is complaining about:
> 
> routing.c: In function 'batadv_find_router':
> routing.c:431:28: warning: 'next_candidate_router' may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> 
> Although this is bogus, silencing is not expensive and is done by this
> patch.
> 
> Introduced by 797edd9e87ac838711e03498a4ae795b600191af
> ("batman-adv: add bonding again")
> 
> Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
> ---
>  routing.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision aed390d.

Thanks,
Marek
  

Patch

diff --git a/routing.c b/routing.c
index 69620e0..23311f5 100644
--- a/routing.c
+++ b/routing.c
@@ -428,7 +428,7 @@  batadv_find_router(struct batadv_priv *bat_priv,
 {
 	struct batadv_algo_ops *bao = bat_priv->bat_algo_ops;
 	struct batadv_neigh_node *first_candidate_router = NULL;
-	struct batadv_neigh_node *next_candidate_router;
+	struct batadv_neigh_node *next_candidate_router = NULL;
 	struct batadv_neigh_node *router, *cand_router = NULL;
 	struct batadv_orig_ifinfo *cand, *first_candidate = NULL;
 	struct batadv_orig_ifinfo *next_candidate = NULL;