CC: [email protected] BCC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: Keerthy <[email protected]> TO: [email protected] TO: [email protected] TO: [email protected] TO: [email protected] TO: [email protected] TO: [email protected] TO: [email protected] CC: [email protected] CC: [email protected] CC: [email protected] CC: [email protected]
Hi Keerthy, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on rafael-pm/thermal v5.18-rc4 next-20220428] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/intel-lab-lkp/linux/commits/Keerthy/thermal-k3_j72xx_bandgap-Add-the-bandgap-driver-support/20220427-144949 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next :::::: branch date: 33 hours ago :::::: commit date: 33 hours ago compiler: xtensa-linux-gcc (GCC) 11.3.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout bb7f95a68cbaa1b42612b447a058a53a788ecb20 cppcheck --quiet --enable=style,performance,portability --template=gcc FILE If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> cppcheck possible warnings: (new ones prefixed by >>, may not real problems) >> drivers/thermal/k3_j72xx_bandgap.c:83:12: warning: Parameter 'ref_table' can >> be declared with const [constParameter] int *ref_table) ^ vim +/ref_table +83 drivers/thermal/k3_j72xx_bandgap.c bb7f95a68cbaa1b Keerthy 2022-04-27 81 bb7f95a68cbaa1b Keerthy 2022-04-27 82 static void create_table_segments(struct err_values *err_vals, int seg, bb7f95a68cbaa1b Keerthy 2022-04-27 @83 int *ref_table) bb7f95a68cbaa1b Keerthy 2022-04-27 84 { bb7f95a68cbaa1b Keerthy 2022-04-27 85 int m = 0, c, num, den, i, err, idx1, idx2, err1, err2, ref1, ref2; bb7f95a68cbaa1b Keerthy 2022-04-27 86 bb7f95a68cbaa1b Keerthy 2022-04-27 87 if (seg == 0) bb7f95a68cbaa1b Keerthy 2022-04-27 88 idx1 = 0; bb7f95a68cbaa1b Keerthy 2022-04-27 89 else bb7f95a68cbaa1b Keerthy 2022-04-27 90 idx1 = err_vals->refs[seg]; bb7f95a68cbaa1b Keerthy 2022-04-27 91 bb7f95a68cbaa1b Keerthy 2022-04-27 92 idx2 = err_vals->refs[seg + 1]; bb7f95a68cbaa1b Keerthy 2022-04-27 93 err1 = err_vals->errs[seg]; bb7f95a68cbaa1b Keerthy 2022-04-27 94 err2 = err_vals->errs[seg + 1]; bb7f95a68cbaa1b Keerthy 2022-04-27 95 ref1 = err_vals->refs[seg]; bb7f95a68cbaa1b Keerthy 2022-04-27 96 ref2 = err_vals->refs[seg + 1]; bb7f95a68cbaa1b Keerthy 2022-04-27 97 bb7f95a68cbaa1b Keerthy 2022-04-27 98 /* bb7f95a68cbaa1b Keerthy 2022-04-27 99 * Calculate the slope with adc values read from the register bb7f95a68cbaa1b Keerthy 2022-04-27 100 * as the y-axis param and err in adc value as x-axis param bb7f95a68cbaa1b Keerthy 2022-04-27 101 */ bb7f95a68cbaa1b Keerthy 2022-04-27 102 num = ref2 - ref1; bb7f95a68cbaa1b Keerthy 2022-04-27 103 den = err2 - err1; bb7f95a68cbaa1b Keerthy 2022-04-27 104 if (den) bb7f95a68cbaa1b Keerthy 2022-04-27 105 m = num / den; bb7f95a68cbaa1b Keerthy 2022-04-27 106 c = ref2 - m * err2; bb7f95a68cbaa1b Keerthy 2022-04-27 107 bb7f95a68cbaa1b Keerthy 2022-04-27 108 /* bb7f95a68cbaa1b Keerthy 2022-04-27 109 * Take care of divide by zero error if error values are same bb7f95a68cbaa1b Keerthy 2022-04-27 110 * Or when the slope is 0 bb7f95a68cbaa1b Keerthy 2022-04-27 111 */ bb7f95a68cbaa1b Keerthy 2022-04-27 112 if (den != 0 && m != 0) { bb7f95a68cbaa1b Keerthy 2022-04-27 113 for (i = idx1; i <= idx2; i++) { bb7f95a68cbaa1b Keerthy 2022-04-27 114 err = (i - c) / m; bb7f95a68cbaa1b Keerthy 2022-04-27 115 if (((i + err) < 0) || ((i + err) >= TABLE_SIZE)) bb7f95a68cbaa1b Keerthy 2022-04-27 116 continue; bb7f95a68cbaa1b Keerthy 2022-04-27 117 derived_table[i] = ref_table[i + err]; bb7f95a68cbaa1b Keerthy 2022-04-27 118 } bb7f95a68cbaa1b Keerthy 2022-04-27 119 } else { /* Constant error take care of divide by zero */ bb7f95a68cbaa1b Keerthy 2022-04-27 120 for (i = idx1; i <= idx2; i++) { bb7f95a68cbaa1b Keerthy 2022-04-27 121 if (((i + err1) < 0) || ((i + err1) >= TABLE_SIZE)) bb7f95a68cbaa1b Keerthy 2022-04-27 122 continue; bb7f95a68cbaa1b Keerthy 2022-04-27 123 derived_table[i] = ref_table[i + err1]; bb7f95a68cbaa1b Keerthy 2022-04-27 124 } bb7f95a68cbaa1b Keerthy 2022-04-27 125 } bb7f95a68cbaa1b Keerthy 2022-04-27 126 } bb7f95a68cbaa1b Keerthy 2022-04-27 127 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
