lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202201041301.z9yQzYjF-lkp@intel.com>
Date:   Tue, 4 Jan 2022 13:07:32 +0800
From:   kernel test robot <lkp@...el.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Sebastian Reichel <sebastian.reichel@...labora.com>
Subject: [sre-power-supply:for-next 11/28]
 drivers/power/supply/ab8500_btemp.c:527:35: warning: variable 'i' is
 uninitialized when used here

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
head:   25fd330370ac40653671f323acc7fb6db27ef6fe
commit: e5dff305ab5c539320f1e30db44604e9977c3504 [11/28] power: supply: ab8500: Use only one battery type
config: arm-randconfig-r001-20220103 (https://download.01.org/0day-ci/archive/20220104/202201041301.z9yQzYjF-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b50fea47b6c454581fce89af359f3afe5154986c)
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
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/commit/?id=e5dff305ab5c539320f1e30db44604e9977c3504
        git remote add sre-power-supply https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
        git fetch --no-tags sre-power-supply for-next
        git checkout e5dff305ab5c539320f1e30db44604e9977c3504
        # 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=arm SHELL=/bin/bash drivers/power/supply/

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

All warnings (new ones prefixed by >>):

>> drivers/power/supply/ab8500_btemp.c:527:35: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
                            di->bm->bat_type->resis_high, i);
                                                          ^
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
           dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                            ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                       ^~~~~~~~~~~
   drivers/power/supply/ab8500_btemp.c:509:6: note: initialize the variable 'i' to silence this warning
           u8 i;
               ^
                = '\0'
   1 warning generated.


vim +/i +527 drivers/power/supply/ab8500_btemp.c

   497	
   498	/**
   499	 * ab8500_btemp_id() - Identify the connected battery
   500	 * @di:		pointer to the ab8500_btemp structure
   501	 *
   502	 * This function will try to identify the battery by reading the ID
   503	 * resistor. Some brands use a combined ID resistor with a NTC resistor to
   504	 * both be able to identify and to read the temperature of it.
   505	 */
   506	static int ab8500_btemp_id(struct ab8500_btemp *di)
   507	{
   508		int res;
   509		u8 i;
   510	
   511		di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA;
   512	
   513		res =  ab8500_btemp_get_batctrl_res(di);
   514		if (res < 0) {
   515			dev_err(di->dev, "%s get batctrl res failed\n", __func__);
   516			return -ENXIO;
   517		}
   518	
   519		if ((res <= di->bm->bat_type->resis_high) &&
   520		    (res >= di->bm->bat_type->resis_low)) {
   521			dev_info(di->dev, "Battery detected on %s"
   522				 " low %d < res %d < high: %d"
   523				 " index: %d\n",
   524				 di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL ?
   525				 "BATCTRL" : "BATTEMP",
   526				 di->bm->bat_type->resis_low, res,
 > 527				 di->bm->bat_type->resis_high, i);
   528		} else {
   529			dev_warn(di->dev, "Battery identified as unknown"
   530				 ", resistance %d Ohm\n", res);
   531			return -ENXIO;
   532		}
   533	
   534		/*
   535		 * We only have to change current source if the
   536		 * detected type is Type 1 (LIPO) resis_high = 53407, resis_low = 12500
   537		 * if someone hacks this in.
   538		 *
   539		 * FIXME: make sure this is done automatically for the batteries
   540		 * that need it.
   541		 */
   542		if ((di->bm->adc_therm == AB8500_ADC_THERM_BATCTRL) &&
   543		    (di->bm->bat_type->name == POWER_SUPPLY_TECHNOLOGY_LIPO) &&
   544		    (res <= 53407) && (res >= 12500)) {
   545			dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
   546			di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
   547		}
   548	
   549		return 0;
   550	}
   551	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ