2023-12-25 16:37:39

by Julia Lawall

[permalink] [raw]
Subject: drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c:220:21-22: WARNING opportunity for max() (fwd)



---------- Forwarded message ----------
Date: Tue, 26 Dec 2023 00:30:41 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c:220:21-22:
WARNING opportunity for max()

BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Wenjing Liu <[email protected]>
CC: Alex Deucher <[email protected]>
CC: George Shen <[email protected]>
CC: Jun Lei <[email protected]>

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 861deac3b092f37b2c5e6871732f3e11486f7082
commit: bc33f5e5f05ba44e48909e2cfc5a97475ec69a4d drm/amd/display: create accessories, hwss and protocols sub folders in link
date: 11 months ago
:::::: branch date: 2 days ago
:::::: commit date: 11 months ago
config: loongarch-randconfig-r062-20231222 (https://download.01.org/0day-ci/archive/20231226/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0

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 <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c:220:21-22: WARNING opportunity for max()
drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c:227:21-22: WARNING opportunity for max()

vim +220 drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c

4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 204
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 205 static uint32_t defer_delay_converter_wa(
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 206 struct ddc_service *ddc,
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 207 uint32_t defer_delay)
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 208 {
d0778ebfd58f56 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-07-22 209 struct dc_link *link = ddc->link;
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 210
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 211 if (link->dpcd_caps.dongle_type == DISPLAY_DONGLE_DP_VGA_CONVERTER &&
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 212 link->dpcd_caps.branch_dev_id == DP_BRANCH_DEVICE_ID_0080E1 &&
10a9accd4842e6 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Ilya 2022-02-10 213 (link->dpcd_caps.branch_fw_revision[0] < 0x01 ||
10a9accd4842e6 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Ilya 2022-02-10 214 (link->dpcd_caps.branch_fw_revision[0] == 0x01 &&
10a9accd4842e6 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Ilya 2022-02-10 215 link->dpcd_caps.branch_fw_revision[1] < 0x40)) &&
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 216 !memcmp(link->dpcd_caps.branch_dev_name,
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 217 DP_VGA_DONGLE_BRANCH_DEV_NAME,
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 218 sizeof(link->dpcd_caps.branch_dev_name)))
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 219
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 @220 return defer_delay > DPVGA_DONGLE_AUX_DEFER_WA_DELAY ?
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 221 defer_delay : DPVGA_DONGLE_AUX_DEFER_WA_DELAY;
fd952d436446cf drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Taimur Hassan 2021-01-15 222
df3b7e32ed459a drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Qingqing Zhuo 2019-07-31 223 if (link->dpcd_caps.branch_dev_id == DP_BRANCH_DEVICE_ID_0080E1 &&
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 224 !memcmp(link->dpcd_caps.branch_dev_name,
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 225 DP_DVI_CONVERTER_ID_4,
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 226 sizeof(link->dpcd_caps.branch_dev_name)))
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 227 return defer_delay > I2C_OVER_AUX_DEFER_WA_DELAY ?
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 228 defer_delay : I2C_OVER_AUX_DEFER_WA_DELAY;
7154a51b534707 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c jinlong zhang 2020-09-25 229 if (link->dpcd_caps.branch_dev_id == DP_BRANCH_DEVICE_ID_006037 &&
7154a51b534707 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c jinlong zhang 2020-09-25 230 !memcmp(link->dpcd_caps.branch_dev_name,
7154a51b534707 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c jinlong zhang 2020-09-25 231 DP_DVI_CONVERTER_ID_5,
7154a51b534707 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c jinlong zhang 2020-09-25 232 sizeof(link->dpcd_caps.branch_dev_name)))
7154a51b534707 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c jinlong zhang 2020-09-25 233 return defer_delay > I2C_OVER_AUX_DEFER_WA_DELAY_1MS ?
7154a51b534707 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c jinlong zhang 2020-09-25 234 I2C_OVER_AUX_DEFER_WA_DELAY_1MS : defer_delay;
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 235
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 236 return defer_delay;
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 237 }
4562236b3bc0a2 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c Harry Wentland 2017-09-12 238

:::::: The code at line 220 was first introduced by commit
:::::: fd952d436446cffdf97a61bf456a0987011e42e0 drm/amd/display: Workaround for some legacy DP-VGA dongles

:::::: TO: Taimur Hassan <[email protected]>
:::::: CC: Alex Deucher <[email protected]>

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