提交 e6223a3b 编写于 作者: N Namhyung Kim 提交者: Linus Torvalds

mm: add casts to/from gfp_t in gfp_to_alloc_flags()

This removes following warning from sparse:

 mm/page_alloc.c:1934:9: warning: restricted gfp_t degrades to integer
Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0116651c
...@@ -1932,7 +1932,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask) ...@@ -1932,7 +1932,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
const gfp_t wait = gfp_mask & __GFP_WAIT; const gfp_t wait = gfp_mask & __GFP_WAIT;
/* __GFP_HIGH is assumed to be the same as ALLOC_HIGH to save a branch. */ /* __GFP_HIGH is assumed to be the same as ALLOC_HIGH to save a branch. */
BUILD_BUG_ON(__GFP_HIGH != ALLOC_HIGH); BUILD_BUG_ON(__GFP_HIGH != (__force gfp_t) ALLOC_HIGH);
/* /*
* The caller may dip into page reserves a bit more if the caller * The caller may dip into page reserves a bit more if the caller
...@@ -1940,7 +1940,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask) ...@@ -1940,7 +1940,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
* policy or is asking for __GFP_HIGH memory. GFP_ATOMIC requests will * policy or is asking for __GFP_HIGH memory. GFP_ATOMIC requests will
* set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH). * set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH).
*/ */
alloc_flags |= (gfp_mask & __GFP_HIGH); alloc_flags |= (__force int) (gfp_mask & __GFP_HIGH);
if (!wait) { if (!wait) {
alloc_flags |= ALLOC_HARDER; alloc_flags |= ALLOC_HARDER;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册