Re: [PATCH v7 3/9] misc: smpro-errmon: Add Ampere's SMpro error monitor driver

kernel test robot
2022-03-21T14:28:21Z

Hi Quan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on groeck-staging/hwmon-next lee-mfd/for-mfd-next v5.17 next-20220318]
[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/0day-ci/linux/commits/Quan-Nguyen/Add-Ampere-s-Altra-SMPro-MFD-and-its-child-drivers/20220321-161811
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 37fd83916da2e4cae03d350015c82a67b1b334c4
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220321/202203212244.dJ8wLdCt-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3e85c45303bab9bd02a4761bc7e182fb001ac625
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Quan-Nguyen/Add-Ampere-s-Altra-SMPro-MFD-and-its-child-drivers/20220321-161811
git checkout 3e85c45303bab9bd02a4761bc7e182fb001ac625
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/hwmon/ drivers/misc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/misc/smpro-errmon.c:276:6: warning: variable 'data_hi' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (addr2 != 0xff) {
^~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:303:28: note: uninitialized use occurs here
ret_hi & 0xff, ret_lo, data_hi, data_lo);
^~~~~~~
drivers/misc/smpro-errmon.c:276:2: note: remove the 'if' if its condition is always true
if (addr2 != 0xff) {
^~~~~~~~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:265:47: note: initialize the variable 'data_hi' to silence this warning
unsigned int ret_hi, ret_lo, data_lo, data_hi;
^
= 0
>> drivers/misc/smpro-errmon.c:276:6: warning: variable 'data_lo' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (addr2 != 0xff) {
^~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:303:37: note: uninitialized use occurs here
ret_hi & 0xff, ret_lo, data_hi, data_lo);
^~~~~~~
drivers/misc/smpro-errmon.c:276:2: note: remove the 'if' if its condition is always true
if (addr2 != 0xff) {
^~~~~~~~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:265:38: note: initialize the variable 'data_lo' to silence this warning
unsigned int ret_hi, ret_lo, data_lo, data_hi;
^
= 0
2 warnings generated.

vim +276 drivers/misc/smpro-errmon.c

261
262 static s32 smpro_internal_err_get_info(struct regmap *regmap, u8 addr, u8 addr1,
263 u8 addr2, u8 addr3, u8 subtype, char *buf)
264 {
265 unsigned int ret_hi, ret_lo, data_lo, data_hi;
266 int ret;
267
268 ret = regmap_read(regmap, addr, &ret_lo);
269 if (ret)
270 return ret;
271
272 ret = regmap_read(regmap, addr1, &ret_hi);
273 if (ret)
274 return ret;
275
> 276 if (addr2 != 0xff) {
277 ret = regmap_read(regmap, addr2, &data_lo);
278 if (ret)
279 return ret;
280 ret = regmap_read(regmap, addr3, &data_hi);
281 if (ret)
282 return ret;
283 }
284 /*
285 * Output format:
286 * <errType> <image> <Location> <errorCode>
287 * Where:
288 * + errType: SCP Error Type (3 bits)
289 * 1: Warning
290 * 2: Error
291 * 4: Error with data
292 * + image: SCP Image Code (8 bits)
293 * + dir: Direction (1 bit)
294 * 0: Enter
295 * 1: Exit
296 * + location: SCP Module Location Code (8 bits)
297 * + errorCode: SCP Error Code (16 bits)
298 * + data : Extensive data (32 bits)
299 * All bits are 0 when errType is warning or error.
300 */
301 return scnprintf(buf, MAX_MSG_LEN, "%01x %02x %01x %02x %04x %04x%04x\n",
302 subtype, (ret_hi & 0xf000) >> 12, (ret_hi & 0x0800) >> 11,
303 ret_hi & 0xff, ret_lo, data_hi, data_lo);
304 }
305

--
0-DAY CI Kernel Test Service