* [shenki:aspeed-6.9-rebase 573/1143] drivers/i2c/busses/i2c-ast2600.c:323:18: warning: variable 'baseclk_idx' is used uninitialized whenever 'for' loop exits because its condition is false
@ 2024-05-07 12:12 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-07 12:12 UTC (permalink / raw)
To: Joel Stanley; +Cc: oe-kbuild-all
tree: https://github.com/shenki/linux aspeed-6.9-rebase
head: 9bdcee91eb5d9149678acb9d066e9dafbd026721
commit: c12bf580f6b97c976fd39e32a377464f8c9a005b [573/1143] i2c: ast2600 i2c clock refine
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20240507/202405072034.EWXB4OeL-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240507/202405072034.EWXB4OeL-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405072034.EWXB4OeL-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/i2c/busses/i2c-ast2600.c:11:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2208:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-ast2600.c:326:20: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
326 | else if ((i > 0) || (i < 5))
| ~~~~~~~~^~~~~~~~~~
>> drivers/i2c/busses/i2c-ast2600.c:323:18: warning: variable 'baseclk_idx' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
323 | for (int i = 0; i < 16; i++) {
| ^~~~~~
drivers/i2c/busses/i2c-ast2600.c:338:20: note: uninitialized use occurs here
338 | baseclk_idx = min(baseclk_idx, 15);
| ^~~~~~~~~~~
include/linux/minmax.h:85:38: note: expanded from macro 'min'
85 | #define min(x, y) __careful_cmp(min, x, y)
| ^
include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
58 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^
include/linux/minmax.h:49:24: note: expanded from macro '__cmp_once'
49 | typeof(x) unique_x = (x); \
| ^
drivers/i2c/busses/i2c-ast2600.c:323:18: note: remove the condition if it is always true
323 | for (int i = 0; i < 16; i++) {
| ^~~~~~
drivers/i2c/busses/i2c-ast2600.c:314:17: note: initialize the variable 'baseclk_idx' to silence this warning
314 | int baseclk_idx;
| ^
| = 0
7 warnings generated.
vim +323 drivers/i2c/busses/i2c-ast2600.c
310
311 static u32 ast2600_select_i2c_clock(struct ast2600_i2c_bus *i2c_bus)
312 {
313 unsigned long base_clk[16];
314 int baseclk_idx;
315 u32 clk_div_reg;
316 u32 scl_low;
317 u32 scl_high;
318 int divisor = 0;
319 u32 data;
320
321 regmap_read(i2c_bus->global_regs, AST2600_I2CG_CLK_DIV_CTRL, &clk_div_reg);
322
> 323 for (int i = 0; i < 16; i++) {
324 if (i == 0)
325 base_clk[i] = i2c_bus->apb_clk;
> 326 else if ((i > 0) || (i < 5))
327 base_clk[i] = (i2c_bus->apb_clk * 2) /
328 (((clk_div_reg >> ((i - 1) * 8)) & GENMASK(7, 0)) + 2);
329 else
330 base_clk[i] = base_clk[4] / (1 << (i - 5));
331
332 if ((base_clk[i] / i2c_bus->timing_info.bus_freq_hz) <= 32) {
333 baseclk_idx = i;
334 divisor = DIV_ROUND_UP(base_clk[i], i2c_bus->timing_info.bus_freq_hz);
335 break;
336 }
337 }
338 baseclk_idx = min(baseclk_idx, 15);
339 divisor = min(divisor, 32);
340 scl_low = min(divisor * 9 / 16 - 1, 15);
341 scl_high = (divisor - scl_low - 2) & GENMASK(3, 0);
342 data = (scl_high - 1) << 20 | scl_high << 16 | scl_low << 12 | baseclk_idx;
343 if (i2c_bus->timeout) {
344 data |= AST2600_I2CC_TOUTBASECLK(AST_I2C_TIMEOUT_CLK);
345 data |= AST2600_I2CC_TTIMEOUT(i2c_bus->timeout);
346 }
347
348 return data;
349 }
350
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-07 12:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 12:12 [shenki:aspeed-6.9-rebase 573/1143] drivers/i2c/busses/i2c-ast2600.c:323:18: warning: variable 'baseclk_idx' is used uninitialized whenever 'for' loop exits because its condition is false kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).