From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/net/wireless/realtek/rtw89/rtw8852c.c:2062:32-33: WARNING opportunity for max()
Date: Tue, 06 Oct 2026 04:15:05 +0200 [thread overview]
Message-ID: <202610060455.pNejDA8w-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Bitterblue Smith <rtl8821cerfe2@gmail.com>
CC: "Ping-Ke Shih" <pkshih@realtek.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 67f0943b394d920b6c142aad8c6af94340342ae7
commit: 0d971ffdae584ea4a5b413318b4945b3d273a75a wifi: rtw89: Enable the new rtw89_8852cu module
date: 11 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 11 months ago
config: powerpc64-randconfig-r2104-20261005 (https://download.01.org/0day-ci/archive/20261006/202610060455.pNejDA8w-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 195c81658995a4b7531c30a12c5aef6cf2bbd671)
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: 0d971ffdae58 ("wifi: rtw89: Enable the new rtw89_8852cu module")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202610060455.pNejDA8w-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> drivers/net/wireless/realtek/rtw89/rtw8852c.c:2062:32-33: WARNING opportunity for max()
vim +2062 drivers/net/wireless/realtek/rtw89/rtw8852c.c
a9ffae8d3f9d26 Yuan-Han Zhang 2022-03-17 2042
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2043 static void rtw8852c_set_txpwr_ref(struct rtw89_dev *rtwdev,
50191eace88c41 Kuan-Chung Chen 2024-11-11 2044 enum rtw89_phy_idx phy_idx, s16 pwr_ofst)
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2045 {
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2046 static const u32 addr[RF_PATH_NUM_8852C] = {0x5800, 0x7800};
50191eace88c41 Kuan-Chung Chen 2024-11-11 2047 u16 ofst_dec[RF_PATH_NUM_8852C];
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2048 const u32 mask = 0x7FFFFFF;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2049 const u8 ofst_ofdm = 0x4;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2050 const u8 ofst_cck = 0x8;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2051 s16 ref_ofdm = 0;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2052 s16 ref_cck = 0;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2053 u32 val;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2054 u8 i;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2055
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2056 rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set txpwr reference\n");
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2057
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2058 rtw89_mac_txpwr_write32_mask(rtwdev, phy_idx, R_AX_PWR_RATE_CTRL,
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2059 GENMASK(27, 10), 0x0);
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2060
50191eace88c41 Kuan-Chung Chen 2024-11-11 2061 ofst_dec[RF_PATH_A] = pwr_ofst > 0 ? 0 : abs(pwr_ofst);
50191eace88c41 Kuan-Chung Chen 2024-11-11 @2062 ofst_dec[RF_PATH_B] = pwr_ofst > 0 ? pwr_ofst : 0;
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2063
50191eace88c41 Kuan-Chung Chen 2024-11-11 2064 rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set bb ofdm txpwr ref\n");
50191eace88c41 Kuan-Chung Chen 2024-11-11 2065 for (i = 0; i < RF_PATH_NUM_8852C; i++) {
50191eace88c41 Kuan-Chung Chen 2024-11-11 2066 val = rtw8852c_bb_cal_txpwr_ref(rtwdev, phy_idx, ref_ofdm, ofst_dec[i]);
50191eace88c41 Kuan-Chung Chen 2024-11-11 2067 rtw89_phy_write32_idx(rtwdev, addr[i] + ofst_ofdm, mask, val, phy_idx);
50191eace88c41 Kuan-Chung Chen 2024-11-11 2068 }
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2069
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2070 rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set bb cck txpwr ref\n");
50191eace88c41 Kuan-Chung Chen 2024-11-11 2071 for (i = 0; i < RF_PATH_NUM_8852C; i++) {
50191eace88c41 Kuan-Chung Chen 2024-11-11 2072 val = rtw8852c_bb_cal_txpwr_ref(rtwdev, phy_idx, ref_cck, ofst_dec[i]);
50191eace88c41 Kuan-Chung Chen 2024-11-11 2073 rtw89_phy_write32_idx(rtwdev, addr[i] + ofst_cck, mask, val, phy_idx);
50191eace88c41 Kuan-Chung Chen 2024-11-11 2074 }
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2075 }
af0cac159b1c96 Ping-Ke Shih 2022-04-21 2076
:::::: The code at line 2062 was first introduced by commit
:::::: 50191eace88c4163c8990984a8a156f09f226d39 wifi: rtw89: handle different TX power between RF path
:::::: TO: Kuan-Chung Chen <damon.chen@realtek.com>
:::::: CC: Ping-Ke Shih <pkshih@realtek.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-10-06 2:15 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=202610060455.pNejDA8w-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.