diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2016-05-27 17:27:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-27 17:49:37 -0400 |
commit | badbda53e505089062e194c614e6f23450bc98b2 (patch) | |
tree | 315473d53e3c018d2e36f3f4be62abf19ce750aa /mm | |
parent | 0798d3c022dc63eb0ec02b511e1f76ca8411ef8e (diff) |
mm/cma: silence warnings due to max() usage
pageblock_order can be (at least) an unsigned int or an unsigned long
depending on the kernel config and architecture, so use max_t(unsigned
long, ...) when comparing it.
fixes these warnings:
In file included from include/asm-generic/bug.h:13:0,
from arch/powerpc/include/asm/bug.h:127,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/mm.h:8,
from include/linux/memblock.h:18,
from mm/cma.c:28:
mm/cma.c: In function 'cma_init_reserved_mem':
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_max1 == &_max2); ^
mm/cma.c:186:27: note: in expansion of macro 'max'
alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
^
mm/cma.c: In function 'cma_declare_contiguous':
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_max1 == &_max2); ^
include/linux/kernel.h:747:9: note: in definition of macro 'max'
typeof(y) _max2 = (y); ^
mm/cma.c:270:29: note: in expansion of macro 'max'
(phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
^
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_max1 == &_max2); ^
include/linux/kernel.h:747:21: note: in definition of macro 'max'
typeof(y) _max2 = (y); ^
mm/cma.c:270:29: note: in expansion of macro 'max'
(phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
^
[akpm@linux-foundation.org: coding-style fixes]
Link: http://lkml.kernel.org/r/20160526150748.5be38a4f@canb.auug.org.au
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/cma.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -183,7 +183,8 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, | |||
183 | return -EINVAL; | 183 | return -EINVAL; |
184 | 184 | ||
185 | /* ensure minimal alignment required by mm core */ | 185 | /* ensure minimal alignment required by mm core */ |
186 | alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order); | 186 | alignment = PAGE_SIZE << |
187 | max_t(unsigned long, MAX_ORDER - 1, pageblock_order); | ||
187 | 188 | ||
188 | /* alignment should be aligned with order_per_bit */ | 189 | /* alignment should be aligned with order_per_bit */ |
189 | if (!IS_ALIGNED(alignment >> PAGE_SHIFT, 1 << order_per_bit)) | 190 | if (!IS_ALIGNED(alignment >> PAGE_SHIFT, 1 << order_per_bit)) |
@@ -266,8 +267,8 @@ int __init cma_declare_contiguous(phys_addr_t base, | |||
266 | * migratetype page by page allocator's buddy algorithm. In the case, | 267 | * migratetype page by page allocator's buddy algorithm. In the case, |
267 | * you couldn't get a contiguous memory, which is not what we want. | 268 | * you couldn't get a contiguous memory, which is not what we want. |
268 | */ | 269 | */ |
269 | alignment = max(alignment, | 270 | alignment = max(alignment, (phys_addr_t)PAGE_SIZE << |
270 | (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order)); | 271 | max_t(unsigned long, MAX_ORDER - 1, pageblock_order)); |
271 | base = ALIGN(base, alignment); | 272 | base = ALIGN(base, alignment); |
272 | size = ALIGN(size, alignment); | 273 | size = ALIGN(size, alignment); |
273 | limit &= ~(alignment - 1); | 274 | limit &= ~(alignment - 1); |