lkml.org 
[lkml]   [2015]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking
On Fri 20-11-15 09:40:59, Jeff Layton wrote:
> sparse says:
>
> include/linux/gfp.h:274:26: warning: incorrect type in return expression (different base types)
> include/linux/gfp.h:274:26: expected bool
> include/linux/gfp.h:274:26: got restricted gfp_t
>
> ...add a forced cast to silence the warning.
>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
> ---
> include/linux/gfp.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index 6523109e136d..8942af0813e3 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -271,7 +271,7 @@ static inline int gfpflags_to_migratetype(const gfp_t gfp_flags)
>
> static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
> {
> - return gfp_flags & __GFP_DIRECT_RECLAIM;
> + return (bool __force)(gfp_flags & __GFP_DIRECT_RECLAIM);

Wouldn't (gfp_flags & __GFP_DIRECT_RECLAIM) != 0 be easier/better to read?

--
Michal Hocko
SUSE Labs


\
 
 \ /
  Last update: 2015-11-23 11:21    [W:0.039 / U:1.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site