All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: zynqmp: initialize fract_tick
@ 2022-07-27 10:00 ` alexandre.belloni
  0 siblings, 0 replies; 6+ messages in thread
From: alexandre.belloni @ 2022-07-27 10:00 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Michal Simek
  Cc: linux-rtc, kernel test robot, linux-arm-kernel, linux-kernel

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

fract_tick is used uninitialized when fract_offset is 0

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 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


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

* [PATCH] rtc: zynqmp: initialize fract_tick
@ 2022-07-27 10:00 ` alexandre.belloni
  0 siblings, 0 replies; 6+ messages in thread
From: alexandre.belloni @ 2022-07-27 10:00 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Michal Simek
  Cc: linux-rtc, kernel test robot, linux-arm-kernel, linux-kernel

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

fract_tick is used uninitialized when fract_offset is 0

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] rtc: zynqmp: initialize fract_tick
  2022-07-27 10:00 ` alexandre.belloni
@ 2022-07-27 10:56   ` Michal Simek
  -1 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2022-07-27 10:56 UTC (permalink / raw)
  To: alexandre.belloni, Alessandro Zummo, Michal Simek
  Cc: linux-rtc, kernel test robot, linux-arm-kernel, linux-kernel



On 7/27/22 12:00, alexandre.belloni@bootlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> fract_tick is used uninitialized when fract_offset is 0
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>   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
> 

Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

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

* Re: [PATCH] rtc: zynqmp: initialize fract_tick
@ 2022-07-27 10:56   ` Michal Simek
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2022-07-27 10:56 UTC (permalink / raw)
  To: alexandre.belloni, Alessandro Zummo, Michal Simek
  Cc: linux-rtc, kernel test robot, linux-arm-kernel, linux-kernel



On 7/27/22 12:00, alexandre.belloni@bootlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> fract_tick is used uninitialized when fract_offset is 0
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>   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
> 

Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] rtc: zynqmp: initialize fract_tick
  2022-07-27 10:00 ` alexandre.belloni
@ 2022-08-05 17:04   ` Nathan Chancellor
  -1 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2022-08-05 17:04 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: Alessandro Zummo, Michal Simek, linux-rtc, kernel test robot,
	linux-arm-kernel, linux-kernel, llvm

On Wed, Jul 27, 2022 at 12:00:18PM +0200, alexandre.belloni@bootlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> fract_tick is used uninitialized when fract_offset is 0
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.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
> 
> 

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

* Re: [PATCH] rtc: zynqmp: initialize fract_tick
@ 2022-08-05 17:04   ` Nathan Chancellor
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2022-08-05 17:04 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: Alessandro Zummo, Michal Simek, linux-rtc, kernel test robot,
	linux-arm-kernel, linux-kernel, llvm

On Wed, Jul 27, 2022 at 12:00:18PM +0200, alexandre.belloni@bootlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> fract_tick is used uninitialized when fract_offset is 0
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.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
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-08-05 17:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 10:00 [PATCH] rtc: zynqmp: initialize fract_tick alexandre.belloni
2022-07-27 10:00 ` alexandre.belloni
2022-07-27 10:56 ` Michal Simek
2022-07-27 10:56   ` Michal Simek
2022-08-05 17:04 ` Nathan Chancellor
2022-08-05 17:04   ` Nathan Chancellor

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.