tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   642b151f45dd54809ea00ecd3976a56c1ec9b53d
commit: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time 
sanity check of GENMASK inputs
date:   6 weeks ago
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 295bcca84916cb5079140a89fccb472bb8d1f6e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <l...@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:19,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from drivers/clk/socfpga/clk-gate.c:8:
drivers/clk/socfpga/clk-gate.c: In function 'socfpga_clk_recalc_rate':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                            ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-gate.c:100:10: note: in expansion of macro 'GENMASK'
100 |   val &= GENMASK(socfpgaclk->width - 1, 0);
|          ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                                        ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-gate.c:100:10: note: in expansion of macro 'GENMASK'
100 |   val &= GENMASK(socfpgaclk->width - 1, 0);
|          ^~~~~~~
--
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:19,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from drivers/clk/socfpga/clk-periph.c:8:
drivers/clk/socfpga/clk-periph.c: In function 'clk_periclk_recalc_rate':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                            ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-periph.c:28:11: note: in expansion of macro 'GENMASK'
28 |    val &= GENMASK(socfpgaclk->width - 1, 0);
|           ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                                        ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-periph.c:28:11: note: in expansion of macro 'GENMASK'
28 |    val &= GENMASK(socfpgaclk->width - 1, 0);
|           ^~~~~~~
--
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:19,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from drivers/clk/socfpga/clk-periph-a10.c:5:
drivers/clk/socfpga/clk-periph-a10.c: In function 'clk_periclk_recalc_rate':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                            ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-periph-a10.c:30:10: note: in expansion of macro 
>> 'GENMASK'
30 |   div &= GENMASK(socfpgaclk->width - 1, 0);
|          ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                                        ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-periph-a10.c:30:10: note: in expansion of macro 
>> 'GENMASK'
30 |   div &= GENMASK(socfpgaclk->width - 1, 0);
|          ^~~~~~~
--
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:19,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from drivers/clk/socfpga/clk-gate-a10.c:5:
drivers/clk/socfpga/clk-gate-a10.c: In function 'socfpga_gate_clk_recalc_rate':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                            ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-gate-a10.c:31:10: note: in expansion of macro 
>> 'GENMASK'
31 |   val &= GENMASK(socfpgaclk->width - 1, 0);
|          ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is 
always false [-Wtype-limits]
26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
|                                        ^
include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                              ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/socfpga/clk-gate-a10.c:31:10: note: in expansion of macro 
>> 'GENMASK'
31 |   val &= GENMASK(socfpgaclk->width - 1, 0);
|          ^~~~~~~

vim +/GENMASK +100 drivers/clk/socfpga/clk-gate.c

97259e99bdc914 Steffen Trumtrar 2014-01-06   89  
97259e99bdc914 Steffen Trumtrar 2014-01-06   90  static unsigned long 
socfpga_clk_recalc_rate(struct clk_hw *hwclk,
97259e99bdc914 Steffen Trumtrar 2014-01-06   91         unsigned long 
parent_rate)
97259e99bdc914 Steffen Trumtrar 2014-01-06   92  {
97259e99bdc914 Steffen Trumtrar 2014-01-06   93         struct socfpga_gate_clk 
*socfpgaclk = to_socfpga_gate_clk(hwclk);
97259e99bdc914 Steffen Trumtrar 2014-01-06   94         u32 div = 1, val;
97259e99bdc914 Steffen Trumtrar 2014-01-06   95  
97259e99bdc914 Steffen Trumtrar 2014-01-06   96         if 
(socfpgaclk->fixed_div)
97259e99bdc914 Steffen Trumtrar 2014-01-06   97                 div = 
socfpgaclk->fixed_div;
97259e99bdc914 Steffen Trumtrar 2014-01-06   98         else if 
(socfpgaclk->div_reg) {
97259e99bdc914 Steffen Trumtrar 2014-01-06   99                 val = 
readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
25d4d341d31b34 Andy Shevchenko  2015-07-13 @100                 val &= 
GENMASK(socfpgaclk->width - 1, 0);
97259e99bdc914 Steffen Trumtrar 2014-01-06  101                 /* Check for 
GPIO_DB_CLK by its offset */
97259e99bdc914 Steffen Trumtrar 2014-01-06  102                 if ((int) 
socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
97259e99bdc914 Steffen Trumtrar 2014-01-06  103                         div = 
val + 1;
97259e99bdc914 Steffen Trumtrar 2014-01-06  104                 else
97259e99bdc914 Steffen Trumtrar 2014-01-06  105                         div = 
(1 << val);
97259e99bdc914 Steffen Trumtrar 2014-01-06  106         }
97259e99bdc914 Steffen Trumtrar 2014-01-06  107  
97259e99bdc914 Steffen Trumtrar 2014-01-06  108         return parent_rate / 
div;
97259e99bdc914 Steffen Trumtrar 2014-01-06  109  }
97259e99bdc914 Steffen Trumtrar 2014-01-06  110  

:::::: The code at line 100 was first introduced by commit
:::::: 25d4d341d31b349836e1b12d10be34b9b575c12b clk: socfpga: switch to 
GENMASK()

:::::: TO: Andy Shevchenko <andriy.shevche...@linux.intel.com>
:::::: CC: Stephen Boyd <sb...@codeaurora.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to