Re: [PATCH] ARC: fix __ffs return value to avoid build warnings

From: Eugeniy Paltsev
Date: Fri Dec 14 2018 - 05:47:37 EST


Hi Vineet,

On Thu, 2018-12-13 at 18:23 +0000, Vineet Gupta wrote:
> On 12/13/18 7:43 AM, Eugeniy Paltsev wrote:
> > Change __ffs return value from 'int' to 'unsigned long' as it
> > is done in other implementations (like asm-generic, x86, etc...)
> > to avoid build-time warnings in places where type is strictly
> > checked.
> >
> > As __ffs may return values in [0-31] interval changing return
> > type to unsigned is valid.
> >
> > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@xxxxxxxxxxxx>
>
> Can you please paste a couple of lines of offending output !

---------------------------------->8---------------------------------
CC mm/nobootmem.o
In file included from ./include/asm-generic/bug.h:18:0,
from ./arch/arc/include/asm/bug.h:32,
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 mm/nobootmem.c:14:
mm/nobootmem.c: In function â__free_pages_memoryâ:
./include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
./include/linux/kernel.h:859:4: note: in expansion of macro â__typecheckâ
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
./include/linux/kernel.h:869:24: note: in expansion of macro â__safe_cmpâ
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
./include/linux/kernel.h:878:19: note: in expansion of macro â__careful_cmpâ
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
mm/nobootmem.c:104:11: note: in expansion of macro âminâ
order = min(MAX_ORDER - 1UL, __ffs(start));
^~~
---------------------------------->8---------------------------------

>
> -Vineet
--
Eugeniy Paltsev