]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.9/arc-fix-__ffs-return-value-to-avoid-build-warnings.patch
c74147a9702f4d3bbbb34d8df44c668aac6a114c
[thirdparty/kernel/stable-queue.git] / queue-4.9 / arc-fix-__ffs-return-value-to-avoid-build-warnings.patch
1 From 1ff144d5cd786241b06cf18fb3c4216003277bdc Mon Sep 17 00:00:00 2001
2 From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
3 Date: Thu, 13 Dec 2018 18:42:57 +0300
4 Subject: ARC: fix __ffs return value to avoid build warnings
5
6 [ Upstream commit 4e868f8419cb4cb558c5d428e7ab5629cef864c7 ]
7
8 | CC mm/nobootmem.o
9 |In file included from ./include/asm-generic/bug.h:18:0,
10 | from ./arch/arc/include/asm/bug.h:32,
11 | from ./include/linux/bug.h:5,
12 | from ./include/linux/mmdebug.h:5,
13 | from ./include/linux/gfp.h:5,
14 | from ./include/linux/slab.h:15,
15 | from mm/nobootmem.c:14:
16 |mm/nobootmem.c: In function '__free_pages_memory':
17 |./include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
18 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
19 | ^
20 |./include/linux/kernel.h:859:4: note: in expansion of macro '__typecheck'
21 | (__typecheck(x, y) && __no_side_effects(x, y))
22 | ^~~~~~~~~~~
23 |./include/linux/kernel.h:869:24: note: in expansion of macro '__safe_cmp'
24 | __builtin_choose_expr(__safe_cmp(x, y), \
25 | ^~~~~~~~~~
26 |./include/linux/kernel.h:878:19: note: in expansion of macro '__careful_cmp'
27 | #define min(x, y) __careful_cmp(x, y, <)
28 | ^~~~~~~~~~~~~
29 |mm/nobootmem.c:104:11: note: in expansion of macro 'min'
30 | order = min(MAX_ORDER - 1UL, __ffs(start));
31
32 Change __ffs return value from 'int' to 'unsigned long' as it
33 is done in other implementations (like asm-generic, x86, etc...)
34 to avoid build-time warnings in places where type is strictly
35 checked.
36
37 As __ffs may return values in [0-31] interval changing return
38 type to unsigned is valid.
39
40 Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
41 Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
42 Signed-off-by: Sasha Levin <sashal@kernel.org>
43 ---
44 arch/arc/include/asm/bitops.h | 6 +++---
45 1 file changed, 3 insertions(+), 3 deletions(-)
46
47 diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
48 index 8da87feec59aa..99e6d8948f4ac 100644
49 --- a/arch/arc/include/asm/bitops.h
50 +++ b/arch/arc/include/asm/bitops.h
51 @@ -340,7 +340,7 @@ static inline __attribute__ ((const)) int __fls(unsigned long x)
52 /*
53 * __ffs: Similar to ffs, but zero based (0-31)
54 */
55 -static inline __attribute__ ((const)) int __ffs(unsigned long word)
56 +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long word)
57 {
58 if (!word)
59 return word;
60 @@ -400,9 +400,9 @@ static inline __attribute__ ((const)) int ffs(unsigned long x)
61 /*
62 * __ffs: Similar to ffs, but zero based (0-31)
63 */
64 -static inline __attribute__ ((const)) int __ffs(unsigned long x)
65 +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long x)
66 {
67 - int n;
68 + unsigned long n;
69
70 asm volatile(
71 " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */
72 --
73 2.19.1
74