From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [wireless-next:main 21/36] net/mac80211/scan.c:1000:53-54: WARNING opportunity for max()
Date: Wed, 31 Jan 2024 22:39:37 +0800 [thread overview]
Message-ID: <202401312249.CUHdacar-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Johannes Berg <johannes@sipsolutions.net>
CC: Kalle Valo <kvalo@kernel.org>
CC: linux-wireless@vger.kernel.org
TO: "Michael-CY Lee" <michael-cy.lee@mediatek.com>
CC: Johannes Berg <johannes.berg@intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
head: 28b3df1fe6ba2cb439ba109f095aa841fef3a54f
commit: d60277ac3fc9c9f7887ff813c98d0a71ac2abde2 [21/36] wifi: mac80211: apply duration for SW scan
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: x86_64-randconfig-101-20240131 (https://download.01.org/0day-ci/archive/20240131/202401312249.CUHdacar-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
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
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202401312249.CUHdacar-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> net/mac80211/scan.c:1000:53-54: WARNING opportunity for max()
vim +1000 net/mac80211/scan.c
142b9f5074dc0d Helmut Schaa 2009-07-23 940
2fb3f028a9a46b Helmut Schaa 2009-07-23 941 static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
2fb3f028a9a46b Helmut Schaa 2009-07-23 942 unsigned long *next_delay)
2fb3f028a9a46b Helmut Schaa 2009-07-23 943 {
2fb3f028a9a46b Helmut Schaa 2009-07-23 944 int skip;
2fb3f028a9a46b Helmut Schaa 2009-07-23 945 struct ieee80211_channel *chan;
6ea0a69ca21bbd Johannes Berg 2014-11-19 946 struct cfg80211_scan_request *scan_req;
6ea0a69ca21bbd Johannes Berg 2014-11-19 947
6ea0a69ca21bbd Johannes Berg 2014-11-19 948 scan_req = rcu_dereference_protected(local->scan_req,
0cd8080e46b834 Johannes Berg 2023-08-28 949 lockdep_is_held(&local->hw.wiphy->mtx));
2fb3f028a9a46b Helmut Schaa 2009-07-23 950
0a51b27e956bd9 Johannes Berg 2008-09-08 951 skip = 0;
6ea0a69ca21bbd Johannes Berg 2014-11-19 952 chan = scan_req->channels[local->scan_channel_idx];
0a51b27e956bd9 Johannes Berg 2008-09-08 953
7ca15a0ae86506 Simon Wunderlich 2013-07-08 954 local->scan_chandef.chan = chan;
7ca15a0ae86506 Simon Wunderlich 2013-07-08 955 local->scan_chandef.center_freq1 = chan->center_freq;
b6011960f392d1 Thomas Pedersen 2020-04-01 956 local->scan_chandef.freq1_offset = chan->freq_offset;
7ca15a0ae86506 Simon Wunderlich 2013-07-08 957 local->scan_chandef.center_freq2 = 0;
75b1593533f13a Thomas Pedersen 2020-09-21 958
5add321c329b17 Johannes Berg 2023-08-29 959 /* For scanning on the S1G band, detect the channel width according to
5add321c329b17 Johannes Berg 2023-08-29 960 * the channel being scanned.
75b1593533f13a Thomas Pedersen 2020-09-21 961 */
75b1593533f13a Thomas Pedersen 2020-09-21 962 if (chan->band == NL80211_BAND_S1GHZ) {
75b1593533f13a Thomas Pedersen 2020-09-21 963 local->scan_chandef.width = ieee80211_s1g_channel_width(chan);
75b1593533f13a Thomas Pedersen 2020-09-21 964 goto set_channel;
75b1593533f13a Thomas Pedersen 2020-09-21 965 }
75b1593533f13a Thomas Pedersen 2020-09-21 966
7ca15a0ae86506 Simon Wunderlich 2013-07-08 967 /* If scanning on oper channel, use whatever channel-type
7ca15a0ae86506 Simon Wunderlich 2013-07-08 968 * is currently in use.
7ca15a0ae86506 Simon Wunderlich 2013-07-08 969 */
5add321c329b17 Johannes Berg 2023-08-29 970 if (chan == local->_oper_chandef.chan)
7ca15a0ae86506 Simon Wunderlich 2013-07-08 971 local->scan_chandef = local->_oper_chandef;
7ca15a0ae86506 Simon Wunderlich 2013-07-08 972 else
7ca15a0ae86506 Simon Wunderlich 2013-07-08 973 local->scan_chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
b23b025fe246f3 Ben Greear 2011-02-04 974
75b1593533f13a Thomas Pedersen 2020-09-21 975 set_channel:
584991dccfd347 Johannes Berg 2009-11-02 976 if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL))
0a51b27e956bd9 Johannes Berg 2008-09-08 977 skip = 1;
0a51b27e956bd9 Johannes Berg 2008-09-08 978
0a51b27e956bd9 Johannes Berg 2008-09-08 979 /* advance state machine to next channel/band */
0a51b27e956bd9 Johannes Berg 2008-09-08 980 local->scan_channel_idx++;
0a51b27e956bd9 Johannes Berg 2008-09-08 981
0ee9c13c7c9258 Helmut Schaa 2009-07-25 982 if (skip) {
0ee9c13c7c9258 Helmut Schaa 2009-07-25 983 /* if we skip this channel return to the decision state */
0ee9c13c7c9258 Helmut Schaa 2009-07-25 984 local->next_scan_state = SCAN_DECISION;
2fb3f028a9a46b Helmut Schaa 2009-07-23 985 return;
0ee9c13c7c9258 Helmut Schaa 2009-07-25 986 }
0a51b27e956bd9 Johannes Berg 2008-09-08 987
99c84cb0692729 Johannes Berg 2009-05-08 988 /*
99c84cb0692729 Johannes Berg 2009-05-08 989 * Probe delay is used to update the NAV, cf. 11.1.3.2.2
99c84cb0692729 Johannes Berg 2009-05-08 990 * (which unfortunately doesn't say _why_ step a) is done,
99c84cb0692729 Johannes Berg 2009-05-08 991 * but it waits for the probe delay or until a frame is
99c84cb0692729 Johannes Berg 2009-05-08 992 * received - and the received frame would update the NAV).
99c84cb0692729 Johannes Berg 2009-05-08 993 * For now, we do not support waiting until a frame is
99c84cb0692729 Johannes Berg 2009-05-08 994 * received.
99c84cb0692729 Johannes Berg 2009-05-08 995 *
99c84cb0692729 Johannes Berg 2009-05-08 996 * In any case, it is not necessary for a passive scan.
99c84cb0692729 Johannes Berg 2009-05-08 997 */
4e39ccac0d678e Antonio Quartulli 2015-11-21 998 if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)) ||
4e39ccac0d678e Antonio Quartulli 2015-11-21 999 !scan_req->n_ssids) {
d60277ac3fc9c9 Michael-CY Lee 2024-01-23 @1000 *next_delay = msecs_to_jiffies(scan_req->duration) >
d60277ac3fc9c9 Michael-CY Lee 2024-01-23 1001 IEEE80211_PASSIVE_CHANNEL_TIME ?
d60277ac3fc9c9 Michael-CY Lee 2024-01-23 1002 msecs_to_jiffies(scan_req->duration) :
d60277ac3fc9c9 Michael-CY Lee 2024-01-23 1003 IEEE80211_PASSIVE_CHANNEL_TIME;
977923b00c7918 Helmut Schaa 2009-07-23 1004 local->next_scan_state = SCAN_DECISION;
b041b7b9de6e1d Felix Fietkau 2022-04-20 1005 if (scan_req->n_ssids)
b041b7b9de6e1d Felix Fietkau 2022-04-20 1006 set_bit(SCAN_BEACON_WAIT, &local->scanning);
2fb3f028a9a46b Helmut Schaa 2009-07-23 1007 return;
99c84cb0692729 Johannes Berg 2009-05-08 1008 }
0a51b27e956bd9 Johannes Berg 2008-09-08 1009
2fb3f028a9a46b Helmut Schaa 2009-07-23 1010 /* active scan, send probes */
7d3be3cc489176 Helmut Schaa 2009-07-23 1011 *next_delay = IEEE80211_PROBE_DELAY;
977923b00c7918 Helmut Schaa 2009-07-23 1012 local->next_scan_state = SCAN_SEND_PROBE;
7d3be3cc489176 Helmut Schaa 2009-07-23 1013 }
7d3be3cc489176 Helmut Schaa 2009-07-23 1014
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-01-31 14:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202401312249.CUHdacar-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.