Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2688eba9 authored by Andreea-Cristina Bernat's avatar Andreea-Cristina Bernat Committed by Johannes Berg
Browse files

mac80211: Replace rcu_dereference() with rcu_access_pointer()



The "rcu_dereference()" calls are used directly in conditions.
Since their return values are never dereferenced it is recommended to
use "rcu_access_pointer()" instead of "rcu_dereference()".
Therefore, this patch makes the replacements.

The following Coccinelle semantic patch was used:
@@
@@

(
 if(
 (<+...
- rcu_dereference
+ rcu_access_pointer
  (...)
  ...+>)) {...}
|
 while(
 (<+...
- rcu_dereference
+ rcu_access_pointer
  (...)
  ...+>)) {...}
)

Signed-off-by: default avatarAndreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent ad053a96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -729,7 +729,7 @@ void mesh_plink_broken(struct sta_info *sta)
	tbl = rcu_dereference(mesh_paths);
	for_each_mesh_entry(tbl, node, i) {
		mpath = node->mpath;
		if (rcu_dereference(mpath->next_hop) == sta &&
		if (rcu_access_pointer(mpath->next_hop) == sta &&
		    mpath->flags & MESH_PATH_ACTIVE &&
		    !(mpath->flags & MESH_PATH_FIXED)) {
			spin_lock_bh(&mpath->state_lock);
@@ -794,7 +794,7 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta)
	tbl = resize_dereference_mesh_paths();
	for_each_mesh_entry(tbl, node, i) {
		mpath = node->mpath;
		if (rcu_dereference(mpath->next_hop) == sta) {
		if (rcu_access_pointer(mpath->next_hop) == sta) {
			spin_lock(&tbl->hashwlock[i]);
			__mesh_path_del(tbl, node);
			spin_unlock(&tbl->hashwlock[i]);