[linux-next:master 11446/11650] drivers/pwm/pwm-atmel-hlcdc.c:75:55: warning: 'clk_period_ns' may be used uninitialized in this function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
:::::: CC: Thierry Reding <thierry.reding@xxxxxxxxx>

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

Attachment: .config.gz
Description: Binary data


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]