Usually rcu_dereference isn't necessary in situations were the
RCU-protected data structure cannot change, but sparse and lockdep still
need a similar functionality for analysis. rcu_dereference_protected
implements the reduced version which should be used to support the
dynamic and static analysis.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
        if (new_gw_node && !atomic_inc_not_zero(&new_gw_node->refcount))
                new_gw_node = NULL;
 
-       curr_gw_node = bat_priv->curr_gw;
+       curr_gw_node = rcu_dereference_protected(bat_priv->curr_gw, 1);
        rcu_assign_pointer(bat_priv->curr_gw, new_gw_node);
 
        if (curr_gw_node)
 
        if (new_hard_iface && !atomic_inc_not_zero(&new_hard_iface->refcount))
                new_hard_iface = NULL;
 
-       curr_hard_iface = bat_priv->primary_if;
+       curr_hard_iface = rcu_dereference_protected(bat_priv->primary_if, 1);
        rcu_assign_pointer(bat_priv->primary_if, new_hard_iface);
 
        if (curr_hard_iface)
 
        if (new_neigh && !atomic_inc_not_zero(&new_neigh->refcount))
                new_neigh = NULL;
 
-       curr_neigh = softif_neigh_vid->softif_neigh;
+       curr_neigh = rcu_dereference_protected(softif_neigh_vid->softif_neigh,
+                                              1);
        rcu_assign_pointer(softif_neigh_vid->softif_neigh, new_neigh);
 
        if ((curr_neigh) && (!new_neigh))