[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a27853fb-d0b4-c5b3-c26f-fdc088eea558@inria.fr>
Date: Mon, 23 Sep 2024 07:52:44 +0200 (CEST)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Frank Wang <frank.wang@...k-chips.com>
cc: Guenter Roeck <linux@...ck-us.net>, linux-kernel@...r.kernel.org,
oe-kbuild-all@...ts.linux.dev
Subject: drivers/usb/typec/tcpm/tcpm.c:6356:20-21: WARNING opportunity for
max() (fwd)
---------- Forwarded message ----------
Date: Mon, 23 Sep 2024 10:57:07 +0800
From: kernel test robot <lkp@...el.com>
To: oe-kbuild@...ts.linux.dev
Cc: lkp@...el.com, Julia Lawall <julia.lawall@...ia.fr>
Subject: drivers/usb/typec/tcpm/tcpm.c:6356:20-21: WARNING opportunity for max()
BCC: lkp@...el.com
CC: oe-kbuild-all@...ts.linux.dev
CC: linux-kernel@...r.kernel.org
TO: Frank Wang <frank.wang@...k-chips.com>
CC: Guenter Roeck <linux@...ck-us.net>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: de5cb0dcb74c294ec527eddfe5094acfdb21ff21
commit: 8be558dcffe69b078b34b1fa93b82acaf4ce4957 usb: typec: tcpm: add get max power support
date: 1 year, 3 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 1 year, 3 months ago
config: arc-randconfig-r054-20240923 (https://download.01.org/0day-ci/archive/20240923/202409231009.2efXAh9b-lkp@intel.com/config)
compiler: arc-elf-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 <lkp@...el.com>
| Reported-by: Julia Lawall <julia.lawall@...ia.fr>
| Closes: https://lore.kernel.org/r/202409231009.2efXAh9b-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> drivers/usb/typec/tcpm/tcpm.c:6356:20-21: WARNING opportunity for max()
vim +6356 drivers/usb/typec/tcpm/tcpm.c
f2a8aa053c1761 drivers/usb/typec/tcpm.c Adam Thomson 2018-04-23 6342
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6343 static int tcpm_psy_get_input_power_limit(struct tcpm_port *port,
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6344 union power_supply_propval *val)
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6345 {
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6346 unsigned int src_mv, src_ma, max_src_uw = 0;
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6347 unsigned int i, tmp;
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6348
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6349 for (i = 0; i < port->nr_source_caps; i++) {
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6350 u32 pdo = port->source_caps[i];
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6351
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6352 if (pdo_type(pdo) == PDO_TYPE_FIXED) {
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6353 src_mv = pdo_fixed_voltage(pdo);
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6354 src_ma = pdo_max_current(pdo);
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6355 tmp = src_mv * src_ma;
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 @6356 max_src_uw = tmp > max_src_uw ? tmp : max_src_uw;
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6357 }
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6358 }
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6359
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6360 val->intval = max_src_uw;
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6361 return 0;
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6362 }
8be558dcffe69b drivers/usb/typec/tcpm/tcpm.c Frank Wang 2023-06-16 6363
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists