Commit 7dd50fd5 authored by Mukesh Sisodiya's avatar Mukesh Sisodiya Committed by Johannes Berg

wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer

While vif pointers are protected by the corresponding "*active"
fields, static checkers can get confused sometimes. Add an explicit
check.
Signed-off-by: default avatarMukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614154951.78749ae91fb5.Id3c05d13eeee6638f0930f750e93fb928d5c9dee@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent edcda51d
...@@ -647,30 +647,32 @@ static void iwl_mvm_power_set_pm(struct iwl_mvm *mvm, ...@@ -647,30 +647,32 @@ static void iwl_mvm_power_set_pm(struct iwl_mvm *mvm,
return; return;
/* enable PM on bss if bss stand alone */ /* enable PM on bss if bss stand alone */
if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active) { if (bss_mvmvif && vifs->bss_active && !vifs->p2p_active &&
!vifs->ap_active) {
bss_mvmvif->pm_enabled = true; bss_mvmvif->pm_enabled = true;
return; return;
} }
/* enable PM on p2p if p2p stand alone */ /* enable PM on p2p if p2p stand alone */
if (vifs->p2p_active && !vifs->bss_active && !vifs->ap_active) { if (p2p_mvmvif && vifs->p2p_active && !vifs->bss_active &&
!vifs->ap_active) {
p2p_mvmvif->pm_enabled = true; p2p_mvmvif->pm_enabled = true;
return; return;
} }
if (vifs->bss_active && vifs->p2p_active) if (p2p_mvmvif && bss_mvmvif && vifs->bss_active && vifs->p2p_active)
client_same_channel = client_same_channel =
iwl_mvm_have_links_same_channel(bss_mvmvif, p2p_mvmvif); iwl_mvm_have_links_same_channel(bss_mvmvif, p2p_mvmvif);
if (vifs->bss_active && vifs->ap_active) if (bss_mvmvif && ap_mvmvif && vifs->bss_active && vifs->ap_active)
ap_same_channel = ap_same_channel =
iwl_mvm_have_links_same_channel(bss_mvmvif, ap_mvmvif); iwl_mvm_have_links_same_channel(bss_mvmvif, ap_mvmvif);
/* clients are not stand alone: enable PM if DCM */ /* clients are not stand alone: enable PM if DCM */
if (!(client_same_channel || ap_same_channel)) { if (!(client_same_channel || ap_same_channel)) {
if (vifs->bss_active) if (bss_mvmvif && vifs->bss_active)
bss_mvmvif->pm_enabled = true; bss_mvmvif->pm_enabled = true;
if (vifs->p2p_active) if (p2p_mvmvif && vifs->p2p_active)
p2p_mvmvif->pm_enabled = true; p2p_mvmvif->pm_enabled = true;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment