public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* Re: [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support
       [not found] <20220613125836.523449-3-srinivas.neeli@xilinx.com>
@ 2022-06-14  4:04 ` kernel test robot
  2022-06-14  4:24 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-06-14  4:04 UTC (permalink / raw)
  To: Srinivas Neeli; +Cc: llvm, kbuild-all

Hi Srinivas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.19-rc2 next-20220610]
[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/Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-a006-20220613 (https://download.01.org/0day-ci/archive/20220614/202206141140.xDnN0yu1-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c97436f8b6e2718286e8496faf53a2c800e281cf)
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/intel-lab-lkp/linux/commit/2781fd75583878d86f256113b19bb005dc83fb70
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
        git checkout 2781fd75583878d86f256113b19bb005dc83fb70
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/rtc/

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

All warnings (new ones prefixed by >>):

>> drivers/rtc/rtc-zynqmp.c:223:7: warning: variable 'fract_tick' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:238:6: note: uninitialized use occurs here
           if (fract_tick)
               ^~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:223:3: note: remove the 'if' if its condition is always true
                   if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:218:6: warning: variable 'fract_tick' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (fract_offset) {
               ^~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:238:6: note: uninitialized use occurs here
           if (fract_tick)
               ^~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:218:2: note: remove the 'if' if its condition is always true
           if (fract_offset) {
           ^~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:206:26: note: initialize the variable 'fract_tick' to silence this warning
           unsigned char fract_tick;
                                   ^
                                    = '\0'
   2 warnings generated.


vim +223 drivers/rtc/rtc-zynqmp.c

   200	
   201	static int xlnx_rtc_set_offset(struct device *dev, long offset)
   202	{
   203		struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
   204		unsigned long long rtc_ppb = RTC_PPB;
   205		unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
   206		unsigned char fract_tick;
   207		unsigned int calibval;
   208		short int  max_tick;
   209		int fract_offset;
   210	
   211		if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
   212			return -ERANGE;
   213	
   214		/* Number ticks for given offset */
   215		max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
   216	
   217		/* Number fractional ticks for given offset */
   218		if (fract_offset) {
   219			if (fract_offset < 0) {
   220				fract_offset = fract_offset + tick_mult;
   221				max_tick--;
   222			}
 > 223			if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
   224				for (fract_tick = 1; fract_tick < 16; fract_tick++) {
   225					if (fract_offset <=
   226					    (fract_tick *
   227					     (tick_mult / RTC_FR_MAX_TICKS)))
   228						break;
   229				}
   230			}
   231		}
   232	
   233		/* Zynqmp RTC uses second and fractional tick
   234		 * counters for compensation
   235		 */
   236		calibval = max_tick + RTC_CALIB_DEF;
   237	
   238		if (fract_tick)
   239			calibval |= RTC_FR_EN;
   240	
   241		calibval |= (fract_tick << RTC_FR_DATSHIFT);
   242	
   243		writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
   244	
   245		return 0;
   246	}
   247	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support
       [not found] <20220613125836.523449-3-srinivas.neeli@xilinx.com>
  2022-06-14  4:04 ` [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support kernel test robot
@ 2022-06-14  4:24 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-06-14  4:24 UTC (permalink / raw)
  To: Srinivas Neeli; +Cc: llvm, kbuild-all

Hi Srinivas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.19-rc2 next-20220610]
[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/Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-randconfig-r035-20220612 (https://download.01.org/0day-ci/archive/20220614/202206141232.8nBAsby4-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c97436f8b6e2718286e8496faf53a2c800e281cf)
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://github.com/intel-lab-lkp/linux/commit/2781fd75583878d86f256113b19bb005dc83fb70
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
        git checkout 2781fd75583878d86f256113b19bb005dc83fb70
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/rtc/

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

All warnings (new ones prefixed by >>):

>> drivers/rtc/rtc-zynqmp.c:223:7: warning: variable 'fract_tick' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:238:6: note: uninitialized use occurs here
           if (fract_tick)
               ^~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:223:3: note: remove the 'if' if its condition is always true
                   if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:218:6: warning: variable 'fract_tick' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (fract_offset) {
               ^~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:238:6: note: uninitialized use occurs here
           if (fract_tick)
               ^~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:218:2: note: remove the 'if' if its condition is always true
           if (fract_offset) {
           ^~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-zynqmp.c:206:26: note: initialize the variable 'fract_tick' to silence this warning
           unsigned char fract_tick;
                                   ^
                                    = '\0'
   2 warnings generated.


vim +223 drivers/rtc/rtc-zynqmp.c

   200	
   201	static int xlnx_rtc_set_offset(struct device *dev, long offset)
   202	{
   203		struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
   204		unsigned long long rtc_ppb = RTC_PPB;
   205		unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
   206		unsigned char fract_tick;
   207		unsigned int calibval;
   208		short int  max_tick;
   209		int fract_offset;
   210	
   211		if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
   212			return -ERANGE;
   213	
   214		/* Number ticks for given offset */
   215		max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
   216	
   217		/* Number fractional ticks for given offset */
   218		if (fract_offset) {
   219			if (fract_offset < 0) {
   220				fract_offset = fract_offset + tick_mult;
   221				max_tick--;
   222			}
 > 223			if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
   224				for (fract_tick = 1; fract_tick < 16; fract_tick++) {
   225					if (fract_offset <=
   226					    (fract_tick *
   227					     (tick_mult / RTC_FR_MAX_TICKS)))
   228						break;
   229				}
   230			}
   231		}
   232	
   233		/* Zynqmp RTC uses second and fractional tick
   234		 * counters for compensation
   235		 */
   236		calibval = max_tick + RTC_CALIB_DEF;
   237	
   238		if (fract_tick)
   239			calibval |= RTC_FR_EN;
   240	
   241		calibval |= (fract_tick << RTC_FR_DATSHIFT);
   242	
   243		writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
   244	
   245		return 0;
   246	}
   247	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support
       [not found] <202207012151.nYCjgJqj-lkp@intel.com>
@ 2022-07-07  8:04 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-07-07  8:04 UTC (permalink / raw)
  To: Srinivas Neeli; +Cc: llvm, kbuild-all

Hi Srinivas,

Thanks for your patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.19-rc4 next-20220701]
[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/Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-randconfig-c002-20220629 (https://download.01.org/0day-ci/archive/20220701/202207012151.nYCjgJqj-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a774ba7f60d1fef403b5507b1b1a7475d3684d71)
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://github.com/intel-lab-lkp/linux/commit/2781fd75583878d86f256113b19bb005dc83fb70
         git remote add linux-review https://github.com/intel-lab-lkp/linux
         git fetch --no-tags linux-review Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
         git checkout 2781fd75583878d86f256113b19bb005dc83fb70
         # save the config file
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <yujie.liu@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)

 >> drivers/rtc/rtc-zynqmp.c:238:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
            if (fract_tick)
                ^~~~~~~~~~
    drivers/rtc/rtc-zynqmp.c:206:2: note: 'fract_tick' declared without an initial value
            unsigned char fract_tick;
            ^~~~~~~~~~~~~~~~~~~~~~~~
    drivers/rtc/rtc-zynqmp.c:211:6: note: Assuming the condition is false
            if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
                ^~~~~~~~~~~~~~~~~~~~~~~
    drivers/rtc/rtc-zynqmp.c:211:6: note: Left side of '||' is false
    drivers/rtc/rtc-zynqmp.c:211:33: note: Assuming 'offset' is <= RTC_MAX_OFFSET
            if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
                                           ^~~~~~~~~~~~~~~~~~~~~~~
    drivers/rtc/rtc-zynqmp.c:211:2: note: Taking false branch
            if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
            ^
    drivers/rtc/rtc-zynqmp.c:218:6: note: Assuming 'fract_offset' is 0
            if (fract_offset) {
                ^~~~~~~~~~~~
    drivers/rtc/rtc-zynqmp.c:218:2: note: Taking false branch
            if (fract_offset) {
            ^
    drivers/rtc/rtc-zynqmp.c:238:6: note: Branch condition evaluates to a garbage value
            if (fract_tick)
                ^~~~~~~~~~

vim +238 drivers/rtc/rtc-zynqmp.c

2781fd75583878 Srinivas Neeli  2022-06-13  200
2781fd75583878 Srinivas Neeli  2022-06-13  201  static int xlnx_rtc_set_offset(struct device *dev, long offset)
2781fd75583878 Srinivas Neeli  2022-06-13  202  {
2781fd75583878 Srinivas Neeli  2022-06-13  203  	struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
2781fd75583878 Srinivas Neeli  2022-06-13  204  	unsigned long long rtc_ppb = RTC_PPB;
2781fd75583878 Srinivas Neeli  2022-06-13  205  	unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
2781fd75583878 Srinivas Neeli  2022-06-13 @206  	unsigned char fract_tick;
2781fd75583878 Srinivas Neeli  2022-06-13  207  	unsigned int calibval;
2781fd75583878 Srinivas Neeli  2022-06-13  208  	short int  max_tick;
2781fd75583878 Srinivas Neeli  2022-06-13  209  	int fract_offset;
2781fd75583878 Srinivas Neeli  2022-06-13  210
2781fd75583878 Srinivas Neeli  2022-06-13  211  	if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
2781fd75583878 Srinivas Neeli  2022-06-13  212  		return -ERANGE;
2781fd75583878 Srinivas Neeli  2022-06-13  213
2781fd75583878 Srinivas Neeli  2022-06-13  214  	/* Number ticks for given offset */
2781fd75583878 Srinivas Neeli  2022-06-13  215  	max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
2781fd75583878 Srinivas Neeli  2022-06-13  216
2781fd75583878 Srinivas Neeli  2022-06-13  217  	/* Number fractional ticks for given offset */
2781fd75583878 Srinivas Neeli  2022-06-13  218  	if (fract_offset) {
2781fd75583878 Srinivas Neeli  2022-06-13  219  		if (fract_offset < 0) {
2781fd75583878 Srinivas Neeli  2022-06-13  220  			fract_offset = fract_offset + tick_mult;
2781fd75583878 Srinivas Neeli  2022-06-13  221  			max_tick--;
2781fd75583878 Srinivas Neeli  2022-06-13  222  		}
2781fd75583878 Srinivas Neeli  2022-06-13  223  		if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
2781fd75583878 Srinivas Neeli  2022-06-13  224  			for (fract_tick = 1; fract_tick < 16; fract_tick++) {
2781fd75583878 Srinivas Neeli  2022-06-13  225  				if (fract_offset <=
2781fd75583878 Srinivas Neeli  2022-06-13  226  				    (fract_tick *
2781fd75583878 Srinivas Neeli  2022-06-13  227  				     (tick_mult / RTC_FR_MAX_TICKS)))
2781fd75583878 Srinivas Neeli  2022-06-13  228  					break;
2781fd75583878 Srinivas Neeli  2022-06-13  229  			}
2781fd75583878 Srinivas Neeli  2022-06-13  230  		}
2781fd75583878 Srinivas Neeli  2022-06-13  231  	}
2781fd75583878 Srinivas Neeli  2022-06-13  232
2781fd75583878 Srinivas Neeli  2022-06-13  233  	/* Zynqmp RTC uses second and fractional tick
2781fd75583878 Srinivas Neeli  2022-06-13  234  	 * counters for compensation
11143c19eb57a8 Suneel Garapati 2015-08-19  235  	 */
2781fd75583878 Srinivas Neeli  2022-06-13  236  	calibval = max_tick + RTC_CALIB_DEF;
2781fd75583878 Srinivas Neeli  2022-06-13  237
2781fd75583878 Srinivas Neeli  2022-06-13 @238  	if (fract_tick)
2781fd75583878 Srinivas Neeli  2022-06-13  239  		calibval |= RTC_FR_EN;
2781fd75583878 Srinivas Neeli  2022-06-13  240
2781fd75583878 Srinivas Neeli  2022-06-13  241  	calibval |= (fract_tick << RTC_FR_DATSHIFT);
2781fd75583878 Srinivas Neeli  2022-06-13  242
2781fd75583878 Srinivas Neeli  2022-06-13  243  	writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
2781fd75583878 Srinivas Neeli  2022-06-13  244
2781fd75583878 Srinivas Neeli  2022-06-13  245  	return 0;
11143c19eb57a8 Suneel Garapati 2015-08-19  246  }
11143c19eb57a8 Suneel Garapati 2015-08-19  247

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-07  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220613125836.523449-3-srinivas.neeli@xilinx.com>
2022-06-14  4:04 ` [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support kernel test robot
2022-06-14  4:24 ` kernel test robot
     [not found] <202207012151.nYCjgJqj-lkp@intel.com>
2022-07-07  8:04 ` 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