lkml.org 
[lkml]   [2020]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 51/88] include/linux/log2.h: add missing () around n in roundup_pow_of_two()
    Date
    From: Jason Gunthorpe <jgg@nvidia.com>

    [ Upstream commit 428fc0aff4e59399ec719ffcc1f7a5d29a4ee476 ]

    Otherwise gcc generates warnings if the expression is complicated.

    Fixes: 312a0c170945 ("[PATCH] LOG2: Alter roundup_pow_of_two() so that it can use a ilog2() on a constant")
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Link: https://lkml.kernel.org/r/0-v1-8a2697e3c003+41165-log_brackets_jgg@nvidia.com
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    include/linux/log2.h | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/include/linux/log2.h b/include/linux/log2.h
    index 2af7f77866d03..78496801cddf0 100644
    --- a/include/linux/log2.h
    +++ b/include/linux/log2.h
    @@ -177,7 +177,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
    #define roundup_pow_of_two(n) \
    ( \
    __builtin_constant_p(n) ? ( \
    - (n == 1) ? 1 : \
    + ((n) == 1) ? 1 : \
    (1UL << (ilog2((n) - 1) + 1)) \
    ) : \
    __roundup_pow_of_two(n) \
    --
    2.25.1


    \
     
     \ /
      Last update: 2020-09-08 20:29    [W:4.098 / U:0.188 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site