All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support
Date: Mon, 27 Jun 2022 03:04:29 +0000	[thread overview]
Message-ID: <202206260936.lhyU0jFD-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4845 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220613125836.523449-3-srinivas.neeli@xilinx.com>
References: <20220613125836.523449-3-srinivas.neeli@xilinx.com>
TO: Srinivas Neeli <srinivas.neeli@xilinx.com>

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-rc3 next-20220624]
[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
:::::: branch date: 12 days ago
:::::: commit date: 12 days ago
config: arc-randconfig-m031-20220622
compiler: arceb-elf-gcc (GCC) 11.3.0

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

smatch warnings:
drivers/rtc/rtc-zynqmp.c:238 xlnx_rtc_set_offset() error: uninitialized symbol 'fract_tick'.

vim +/fract_tick +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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support
Date: Mon, 27 Jun 2022 10:39:55 +0300	[thread overview]
Message-ID: <202206260936.lhyU0jFD-lkp@intel.com> (raw)
In-Reply-To: <20220613125836.523449-3-srinivas.neeli@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 4225 bytes --]

Hi Srinivas,

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: arc-randconfig-m031-20220622
compiler: arceb-elf-gcc (GCC) 11.3.0

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

smatch warnings:
drivers/rtc/rtc-zynqmp.c:238 xlnx_rtc_set_offset() error: uninitialized symbol 'fract_tick'.

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

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  		}

"fract_tick" is non-zero on this path so probably it was supposed to be
set to zero@the start.


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)

Uninitialized.

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  }

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

             reply	other threads:[~2022-06-27  3:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  3:04 kernel test robot [this message]
2022-06-27  7:39 ` [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2022-07-01 13:52 kernel test robot
2022-07-07  8:04 ` kernel test robot
2022-06-13 12:58 [PATCH V8 1/3] dt-bindings: rtc: zynqmp: Add clock information Srinivas Neeli
2022-06-13 12:58 ` Srinivas Neeli
2022-06-13 12:58 ` [PATCH V8 2/3] rtc: zynqmp: Updated calibration value Srinivas Neeli
2022-06-13 12:58   ` Srinivas Neeli
2022-06-14 11:39   ` Peter Korsgaard
2022-06-14 11:39     ` Peter Korsgaard
2022-06-13 12:58 ` [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support Srinivas Neeli
2022-06-13 12:58   ` Srinivas Neeli
2022-06-14  4:04   ` kernel test robot
2022-06-14  4:24   ` kernel test robot
2022-06-14 20:51 ` [PATCH V8 1/3] dt-bindings: rtc: zynqmp: Add clock information Rob Herring
2022-06-14 20:51   ` Rob Herring
2022-06-18  0:38 ` Krzysztof Kozlowski
2022-06-18  0:38   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202206260936.lhyU0jFD-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.