drivers/net/wireless: Use RCU_INIT_POINTER(x, NULL) in iwlwifi/mvm/sta.c
Subsystems (3)
PATCH 1/1 drivers/net/wireless: Use RCU_INIT_POINTER(x, NULL) in iwlwifi/mvm/sta.c
This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)
The rcu_assign_pointer() ensures that the initialization of a structure is carried out before storing a pointer to that structure.
And in the case of the NULL pointer, there is no structure to initialize. So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)
--- drivers/net/wireless/iwlwifi/mvm/sta.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/mvm/sta.c +4 -4
@@ -498,7 +498,7 @@ void iwl_mvm_sta_drained_wk(struct work_struct *wk) sta_id);continue ; } -rcu_assign_pointer (mvm->fw_id_to_mac_id[sta_id],NULL ); +RCU_INIT_POINTER (mvm->fw_id_to_mac_id[sta_id],NULL );clear_bit (sta_id, mvm->sta_drained); }
@@ -557,7 +557,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, }else {spin_unlock_bh (&mvm_sta->lock); ret =iwl_mvm_rm_sta_common (mvm, mvm_sta->sta_id); -rcu_assign_pointer (mvm->fw_id_to_mac_id[mvm_sta->sta_id],NULL ); +RCU_INIT_POINTER (mvm->fw_id_to_mac_id[mvm_sta->sta_id],NULL ); }return ret;
@@ -571,7 +571,7 @@ int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm,lockdep_assert_held (&mvm->mutex); -rcu_assign_pointer (mvm->fw_id_to_mac_id[sta_id],NULL ); +RCU_INIT_POINTER (mvm->fw_id_to_mac_id[sta_id],NULL );return ret; }
@@ -593,7 +593,7 @@ int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta,void iwl_mvm_dealloc_int_sta (struct iwl_mvm *mvm,struct iwl_mvm_int_sta *sta) { -rcu_assign_pointer (mvm->fw_id_to_mac_id[sta->sta_id],NULL ); +RCU_INIT_POINTER (mvm->fw_id_to_mac_id[sta->sta_id],NULL );memset (sta,0 ,sizeof (struct iwl_mvm_int_sta )); sta->sta_id =IWL_MVM_STATION_COUNT ; }
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines
This patch replaces
rcu_assign_pointer(x, NULL)withRCU_INIT_POINTER(x, NULL)The
rcu_assign_pointer()ensures that the initialization of a structure is carried out before storing a pointer to that structure. And in the case of the NULL pointer, there is no structure to initialize. So,rcu_assign_pointer(p, NULL)can be safely converted toRCU_INIT_POINTER(p, NULL)
Quoted 5 lines
Signed-off-by Monam Agarwal <[email protected]>--- drivers/net/wireless/iwlwifi/mvm/sta.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Applied - with small change in commit log.
Thank you for your contribution.