drivers/net/wireless/ath/ath12k/wifi7/hw.c:127:21-23: WARNING !A || A && B is equivalent to !A || B

From: kernel test robot

Date: Mon Jul 20 2026 - 09:36:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 94515f3a7d4256a5062176b7d6ed0471938cd51a
commit: ee16dcf573d5e3283fda601dd4bca6bc52251017 wifi: ath12k: Define ath12k_dp_peer structure & APIs for create & delete
date: 9 months ago
config: i386-randconfig-054-20260720 (https://download.01.org/0day-ci/archive/20260720/202607202115.v5KjlijV-lkp@xxxxxxxxx/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: ee16dcf573d5 ("wifi: ath12k: Define ath12k_dp_peer structure & APIs for create & delete")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607202115.v5KjlijV-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/net/wireless/ath/ath12k/wifi7/hw.c:127:21-23: WARNING !A || A && B is equivalent to !A || B

vim +127 drivers/net/wireless/ath/ath12k/wifi7/hw.c

111
112 static bool
113 ath12k_wifi7_is_frame_link_agnostic_wcn7850(struct ath12k_link_vif *arvif,
114 struct ieee80211_mgmt *mgmt)
115 {
116 struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif);
117 struct ath12k_hw *ah = ath12k_ar_to_ah(arvif->ar);
118 struct ath12k_base *ab = arvif->ar->ab;
119 struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
120 struct ath12k_dp_peer *peer;
121 __le16 fc = mgmt->frame_control;
122
123 spin_lock_bh(&dp->dp_lock);
124 if (!ath12k_dp_link_peer_find_by_addr(dp, mgmt->da)) {
125 spin_lock_bh(&ah->dp_hw.peer_lock);
126 peer = ath12k_dp_peer_find_by_addr(&ah->dp_hw, mgmt->da);
> 127 if (!peer || (peer && !peer->is_mlo)) {
128 spin_unlock_bh(&ah->dp_hw.peer_lock);
129 spin_unlock_bh(&dp->dp_lock);
130 return false;
131 }
132 spin_unlock_bh(&ah->dp_hw.peer_lock);
133 }
134 spin_unlock_bh(&dp->dp_lock);
135
136 if (vif->type == NL80211_IFTYPE_STATION)
137 return arvif->is_up &&
138 (vif->valid_links == vif->active_links) &&
139 !ieee80211_is_probe_req(fc) &&
140 !ieee80211_is_auth(fc) &&
141 !ieee80211_is_deauth(fc) &&
142 !ath12k_is_addba_resp_action_code(mgmt);
143
144 if (vif->type == NL80211_IFTYPE_AP)
145 return !(ieee80211_is_probe_resp(fc) || ieee80211_is_auth(fc) ||
146 ieee80211_is_assoc_resp(fc) || ieee80211_is_reassoc_resp(fc) ||
147 ath12k_is_addba_resp_action_code(mgmt));
148
149 return false;
150 }
151

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki