mac80211: Replace rcu_dereference() with rcu_access_pointer()
authorAndreea-Cristina Bernat <bernat.ada@gmail.com>
Sun, 17 Aug 2014 13:18:02 +0000 (16:18 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 27 Aug 2014 10:14:10 +0000 (12:14 +0200)
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: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mesh_pathtbl.c

index cf032a8db9d78e9c13fe9df1ee2f2c35dbe8ec62..a6699dceae7c8aeeff4419d8cc2815f9d86adf5e 100644 (file)
@@ -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]);