diff options
author | Monam Agarwal <monamagarwal123@gmail.com> | 2014-03-23 15:21:43 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-04-09 04:55:30 -0400 |
commit | 0c2bef4621c5feb5bda9068c9964b2e9acf57017 (patch) | |
tree | 0c57534e45d0d072873dcab9b5fddf54b3fef6a7 /net/mac80211/scan.c | |
parent | 34dd886c19547ea138634b98a615ccd1fe42cd20 (diff) |
mac80211: use RCU_INIT_POINTER
rcu_assign_pointer() ensures that the initialization of a structure is
carried out before storing a pointer to that structure. However, in the
case that NULL is assigned there's no structure to initialize so using
RCU_INIT_POINTER instead is safe and more efficient.
Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
[squash eight tiny patches, rewrite commit log]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 3ce7f2c8539a..28185c8dc19a 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -309,7 +309,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
309 | if (local->scan_req != local->int_scan_req) | 309 | if (local->scan_req != local->int_scan_req) |
310 | cfg80211_scan_done(local->scan_req, aborted); | 310 | cfg80211_scan_done(local->scan_req, aborted); |
311 | local->scan_req = NULL; | 311 | local->scan_req = NULL; |
312 | rcu_assign_pointer(local->scan_sdata, NULL); | 312 | RCU_INIT_POINTER(local->scan_sdata, NULL); |
313 | 313 | ||
314 | local->scanning = 0; | 314 | local->scanning = 0; |
315 | local->scan_chandef.chan = NULL; | 315 | local->scan_chandef.chan = NULL; |
@@ -559,7 +559,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, | |||
559 | ieee80211_recalc_idle(local); | 559 | ieee80211_recalc_idle(local); |
560 | 560 | ||
561 | local->scan_req = NULL; | 561 | local->scan_req = NULL; |
562 | rcu_assign_pointer(local->scan_sdata, NULL); | 562 | RCU_INIT_POINTER(local->scan_sdata, NULL); |
563 | } | 563 | } |
564 | 564 | ||
565 | return rc; | 565 | return rc; |
@@ -773,7 +773,7 @@ void ieee80211_scan_work(struct work_struct *work) | |||
773 | int rc; | 773 | int rc; |
774 | 774 | ||
775 | local->scan_req = NULL; | 775 | local->scan_req = NULL; |
776 | rcu_assign_pointer(local->scan_sdata, NULL); | 776 | RCU_INIT_POINTER(local->scan_sdata, NULL); |
777 | 777 | ||
778 | rc = __ieee80211_start_scan(sdata, req); | 778 | rc = __ieee80211_start_scan(sdata, req); |
779 | if (rc) { | 779 | if (rc) { |
@@ -1014,7 +1014,7 @@ out_free: | |||
1014 | 1014 | ||
1015 | if (ret) { | 1015 | if (ret) { |
1016 | /* Clean in case of failure after HW restart or upon resume. */ | 1016 | /* Clean in case of failure after HW restart or upon resume. */ |
1017 | rcu_assign_pointer(local->sched_scan_sdata, NULL); | 1017 | RCU_INIT_POINTER(local->sched_scan_sdata, NULL); |
1018 | local->sched_scan_req = NULL; | 1018 | local->sched_scan_req = NULL; |
1019 | } | 1019 | } |
1020 | 1020 | ||
@@ -1089,7 +1089,7 @@ void ieee80211_sched_scan_stopped_work(struct work_struct *work) | |||
1089 | return; | 1089 | return; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | rcu_assign_pointer(local->sched_scan_sdata, NULL); | 1092 | RCU_INIT_POINTER(local->sched_scan_sdata, NULL); |
1093 | 1093 | ||
1094 | /* If sched scan was aborted by the driver. */ | 1094 | /* If sched scan was aborted by the driver. */ |
1095 | local->sched_scan_req = NULL; | 1095 | local->sched_scan_req = NULL; |