All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 11446/11650] drivers/pwm/pwm-atmel-hlcdc.c:75:55: warning: 'clk_period_ns' may be used uninitialized in this function
@ 2016-01-15  8:56 kbuild test robot
  2016-01-15 16:17 ` Andrey Ryabinin
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2016-01-15  8:56 UTC (permalink / raw)
  To: Andrey Ryabinin; +Cc: kbuild-all, Andrew Morton, Linux Memory Management List

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   39750fe2d360d6f1ccdc6b33d0a5cb624c97a5fd
commit: df423af30988b62df3905601742b8948bbbce329 [11446/11650] UBSAN: run-time undefined behavior sanity checker
config: x86_64-randconfig-s5-01151613 (attached as .config)
reproduce:
        git checkout df423af30988b62df3905601742b8948bbbce329
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/pwm/pwm-atmel-hlcdc.c: In function 'atmel_hlcdc_pwm_config':
>> drivers/pwm/pwm-atmel-hlcdc.c:75:55: warning: 'clk_period_ns' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if ((chip->errata && chip->errata->slow_clk_erratum) ||
                                                          ^

vim +/clk_period_ns +75 drivers/pwm/pwm-atmel-hlcdc.c

2b4984be Boris Brezillon 2014-10-07  59  	u64 pwmcval = duty_ns * 256;
2b4984be Boris Brezillon 2014-10-07  60  	unsigned long clk_freq;
2b4984be Boris Brezillon 2014-10-07  61  	u64 clk_period_ns;
2b4984be Boris Brezillon 2014-10-07  62  	u32 pwmcfg;
2b4984be Boris Brezillon 2014-10-07  63  	int pres;
2b4984be Boris Brezillon 2014-10-07  64  
39e046f2 Boris BREZILLON 2014-11-19  65  	if (!chip->errata || !chip->errata->slow_clk_erratum) {
2b4984be Boris Brezillon 2014-10-07  66  		clk_freq = clk_get_rate(new_clk);
df6922ad Boris BREZILLON 2014-12-18  67  		if (!clk_freq)
df6922ad Boris BREZILLON 2014-12-18  68  			return -EINVAL;
df6922ad Boris BREZILLON 2014-12-18  69  
2b4984be Boris Brezillon 2014-10-07  70  		clk_period_ns = (u64)NSEC_PER_SEC * 256;
2b4984be Boris Brezillon 2014-10-07  71  		do_div(clk_period_ns, clk_freq);
39e046f2 Boris BREZILLON 2014-11-19  72  	}
2b4984be Boris Brezillon 2014-10-07  73  
39e046f2 Boris BREZILLON 2014-11-19  74  	/* Errata: cannot use slow clk on some IP revisions */
39e046f2 Boris BREZILLON 2014-11-19 @75  	if ((chip->errata && chip->errata->slow_clk_erratum) ||
39e046f2 Boris BREZILLON 2014-11-19  76  	    clk_period_ns > period_ns) {
2b4984be Boris Brezillon 2014-10-07  77  		new_clk = hlcdc->sys_clk;
2b4984be Boris Brezillon 2014-10-07  78  		clk_freq = clk_get_rate(new_clk);
df6922ad Boris BREZILLON 2014-12-18  79  		if (!clk_freq)
df6922ad Boris BREZILLON 2014-12-18  80  			return -EINVAL;
df6922ad Boris BREZILLON 2014-12-18  81  
2b4984be Boris Brezillon 2014-10-07  82  		clk_period_ns = (u64)NSEC_PER_SEC * 256;
2b4984be Boris Brezillon 2014-10-07  83  		do_div(clk_period_ns, clk_freq);

:::::: The code at line 75 was first introduced by commit
:::::: 39e046f2c1dd0742976d7ee6e464744cf2122f41 pwm: atmel-hlcdc: add at91sam9x5 and sama5d3 errata handling

:::::: TO: Boris BREZILLON <boris.brezillon@free-electrons.com>
:::::: CC: Thierry Reding <thierry.reding@gmail.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 20771 bytes --]

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

* Re: [linux-next:master 11446/11650] drivers/pwm/pwm-atmel-hlcdc.c:75:55: warning: 'clk_period_ns' may be used uninitialized in this function
  2016-01-15  8:56 [linux-next:master 11446/11650] drivers/pwm/pwm-atmel-hlcdc.c:75:55: warning: 'clk_period_ns' may be used uninitialized in this function kbuild test robot
@ 2016-01-15 16:17 ` Andrey Ryabinin
  0 siblings, 0 replies; 2+ messages in thread
From: Andrey Ryabinin @ 2016-01-15 16:17 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, Andrew Morton, Linux Memory Management List

On 01/15/2016 11:56 AM, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   39750fe2d360d6f1ccdc6b33d0a5cb624c97a5fd
> commit: df423af30988b62df3905601742b8948bbbce329 [11446/11650] UBSAN: run-time undefined behavior sanity checker
> config: x86_64-randconfig-s5-01151613 (attached as .config)
> reproduce:
>         git checkout df423af30988b62df3905601742b8948bbbce329
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
> 

Hmm.. UBSAN (and KASAN too) causes some maybe-uninitialized false positives.
I'm not in favor of mucking different subsystems and initializing these variables as it brings some runtime overhead.
So, perhaps we need turn off UBSAN/KASAN in all[yes|mod]config builds plus build with -Wno-maybe-uninitilized if any of those options enabled.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-01-15 16:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-15  8:56 [linux-next:master 11446/11650] drivers/pwm/pwm-atmel-hlcdc.c:75:55: warning: 'clk_period_ns' may be used uninitialized in this function kbuild test robot
2016-01-15 16:17 ` Andrey Ryabinin

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.