batman-adv: Convert batadv_orig_node to kref

batman-adv uses a self-written reference implementation which is just based
on atomic_t. This is less obvious when reading the code than kref and
therefore increases the change that the reference counting will be missed.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
This commit is contained in:
Sven Eckelmann
2016-01-16 10:29:56 +01:00
committed by Antonio Quartulli
parent 161a3be932
commit 7c12439115
8 changed files with 22 additions and 17 deletions

View File

@@ -858,7 +858,7 @@ static struct batadv_nc_node
if (!nc_node)
return NULL;
if (!atomic_inc_not_zero(&orig_neigh_node->refcount))
if (!kref_get_unless_zero(&orig_neigh_node->refcount))
goto free;
/* Initialize nc_node */