mac80211: scan: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
authorAndreea-Cristina Bernat <bernat.ada@gmail.com>
Fri, 22 Aug 2014 13:14:49 +0000 (16:14 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 26 Aug 2014 09:16:31 +0000 (11:16 +0200)
The use of "rcu_assign_pointer()" is NULLing out the pointer.
According to RCU_INIT_POINTER()'s block comment:
"1.   This use of RCU_INIT_POINTER() is NULLing out the pointer"
it is better to use it instead of rcu_assign_pointer() because it has a
smaller overhead.

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

- rcu_assign_pointer
+ RCU_INIT_POINTER
  (..., NULL)

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/scan.c

index a0a938145dcc87397cb4ecfad5f59b1c5fb28dbc..a9bb6eb8c3e0f8c3f3b8e623a91817f2579e74fe 100644 (file)
@@ -1094,7 +1094,7 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata)
        if (rcu_access_pointer(local->sched_scan_sdata)) {
                ret = drv_sched_scan_stop(local, sdata);
                if (!ret)
-                       rcu_assign_pointer(local->sched_scan_sdata, NULL);
+                       RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
        }
 out:
        mutex_unlock(&local->mtx);