Re: [PATCH v3 5/8] clk: sunxi-ng: nkm: Support finding closest rate
From: kernel test robot
Date: Sun Jul 02 2023 - 16:09:23 EST
Hi Frank,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 6995e2de6891c724bfeb2db33d7b87775f913ad1]
url: https://github.com/intel-lab-lkp/linux/commits/Frank-Oltmanns/clk-sunxi-ng-nkm-consider-alternative-parent-rates-when-determining-rate/20230703-015726
base: 6995e2de6891c724bfeb2db33d7b87775f913ad1
patch link: https://lore.kernel.org/r/20230702-pll-mipi_set_rate_parent-v3-5-46dcb8aa9cbc%40oltmanns.dev
patch subject: [PATCH v3 5/8] clk: sunxi-ng: nkm: Support finding closest rate
config: riscv-rv32_defconfig (https://download.01.org/0day-ci/archive/20230703/202307030302.s1bheEun-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230703/202307030302.s1bheEun-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307030302.s1bheEun-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> drivers/clk/sunxi-ng/ccu_nkm.c:46:24: warning: variable 'tmp_diff' is uninitialized when used here [-Wuninitialized]
46 | tmp_diff = rate - tmp_diff;
| ^~~~~~~~
drivers/clk/sunxi-ng/ccu_nkm.c:33:27: note: initialize the variable 'tmp_diff' to silence this warning
33 | unsigned long tmp_diff;
| ^
| = 0
drivers/clk/sunxi-ng/ccu_nkm.c:93:24: warning: variable 'tmp_diff' is uninitialized when used here [-Wuninitialized]
93 | tmp_diff = rate - tmp_diff;
| ^~~~~~~~
drivers/clk/sunxi-ng/ccu_nkm.c:82:27: note: initialize the variable 'tmp_diff' to silence this warning
82 | unsigned long tmp_diff;
| ^
| = 0
2 warnings generated.
vim +/tmp_diff +46 drivers/clk/sunxi-ng/ccu_nkm.c
19
20 static unsigned long ccu_nkm_find_best_with_parent_adj(unsigned long *parent, unsigned long rate,
21 struct _ccu_nkm *nkm, struct clk_hw *phw,
22 unsigned long features)
23 {
24 unsigned long best_rate = 0, best_parent_rate = 0, tmp_parent = *parent;
25 unsigned long best_diff = ULONG_MAX;
26 unsigned long best_n = 0, best_k = 0, best_m = 0;
27 unsigned long _n, _k, _m;
28
29 for (_k = nkm->min_k; _k <= nkm->max_k; _k++) {
30 for (_n = nkm->min_n; _n <= nkm->max_n; _n++) {
31 for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
32 unsigned long tmp_rate;
33 unsigned long tmp_diff;
34
35 tmp_parent = clk_hw_round_rate(phw, rate * _m / (_n * _k));
36
37 tmp_rate = tmp_parent * _n * _k / _m;
38
39 if (features & CCU_FEATURE_CLOSEST_RATE) {
40 tmp_diff = rate > tmp_rate ?
41 rate - tmp_rate :
42 tmp_rate - rate;
43 } else {
44 if (tmp_rate > rate)
45 continue;
> 46 tmp_diff = rate - tmp_diff;
47 }
48
49 if (tmp_diff < best_diff) {
50 best_rate = tmp_rate;
51 best_parent_rate = tmp_parent;
52 best_diff = tmp_diff;
53 best_n = _n;
54 best_k = _k;
55 best_m = _m;
56 }
57 }
58 }
59 }
60
61 nkm->n = best_n;
62 nkm->k = best_k;
63 nkm->m = best_m;
64
65 *parent = best_parent_rate;
66
67 return best_rate;
68 }
69
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki