From cf78bb0bbcef3fbe1abf118f14b81dad36eaa94e Mon Sep 17 00:00:00 2001
From: Antonio Quartulli
Date: Wed, 20 May 2020 10:41:40 +0200
Subject: batman-adv: use rcu_replace_pointer() where appropriate
In commit a63fc6b75cca ("rcu: Upgrade rcu_swap_protected() to
rcu_replace_pointer()") a new helper macro named rcu_replace_pointer() was
introduced to simplify code requiring to switch an rcu pointer to a new
value while extracting the old one.
Use rcu_replace_pointer() where appropriate to make code slimer.
Signed-off-by: Antonio Quartulli
Signed-off-by: Sven Eckelmann
Signed-off-by: Simon Wunderlich
---
net/batman-adv/gateway_client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'net/batman-adv/gateway_client.c')
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index e22e49289677..a18dcc686dc3 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -146,8 +146,8 @@ static void batadv_gw_select(struct batadv_priv *bat_priv,
if (new_gw_node)
kref_get(&new_gw_node->refcount);
- curr_gw_node = rcu_dereference_protected(bat_priv->gw.curr_gw, 1);
- rcu_assign_pointer(bat_priv->gw.curr_gw, new_gw_node);
+ curr_gw_node = rcu_replace_pointer(bat_priv->gw.curr_gw, new_gw_node,
+ true);
if (curr_gw_node)
batadv_gw_node_put(curr_gw_node);
--
cgit v1.2.3