[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yu1Ngjr5Ux+CN1Nn@dev-arch.thelio-3990X>
Date: Fri, 5 Aug 2022 10:04:02 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: alexandre.belloni@...tlin.com
Cc: Alessandro Zummo <a.zummo@...ertech.it>,
Michal Simek <michal.simek@...inx.com>,
linux-rtc@...r.kernel.org, kernel test robot <lkp@...el.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH] rtc: zynqmp: initialize fract_tick
On Wed, Jul 27, 2022 at 12:00:18PM +0200, alexandre.belloni@...tlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@...tlin.com>
>
> fract_tick is used uninitialized when fract_offset is 0
>
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...tlin.com>
Reviewed-by: Nathan Chancellor <nathan@...nel.org>
Is this going to be applied soon? This is one of the warnings breaking
allmodconfig with clang right now:
drivers/rtc/rtc-zynqmp.c:223:7: error: variable 'fract_tick' is used uninitialized whenever 'if' condition is false [-Werror,-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: error: variable 'fract_tick' is used uninitialized whenever 'if' condition is false [-Werror,-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 errors generated.
> ---
> drivers/rtc/rtc-zynqmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
> index 1dd389b891fe..c9b85c838ebe 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -203,7 +203,7 @@ static int xlnx_rtc_set_offset(struct device *dev, long offset)
> struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
> unsigned long long rtc_ppb = RTC_PPB;
> unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
> - unsigned char fract_tick;
> + unsigned char fract_tick = 0;
> unsigned int calibval;
> short int max_tick;
> int fract_offset;
> --
> 2.36.1
>
>
Powered by blists - more mailing lists