* [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking
@ 2015-11-20 14:40 Jeff Layton
2015-11-23 9:50 ` Michal Hocko
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2015-11-20 14:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: Mel Gorman, linux-mm, linux-kernel
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);
}
#ifdef CONFIG_HIGHMEM
--
2.4.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking
2015-11-20 14:40 [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking Jeff Layton
@ 2015-11-23 9:50 ` Michal Hocko
2015-11-23 11:50 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2015-11-23 9:50 UTC (permalink / raw)
To: Jeff Layton; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel
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
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking
2015-11-23 9:50 ` Michal Hocko
@ 2015-11-23 11:50 ` Jeff Layton
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2015-11-23 11:50 UTC (permalink / raw)
To: Michal Hocko; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel
On Mon, 23 Nov 2015 10:50:49 +0100
Michal Hocko <mhocko@kernel.org> wrote:
> 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?
>
Yeah, good point. Andrew, do you want me to respin that?
--
Jeff Layton <jlayton@poochiereds.net>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-23 11:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 14:40 [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking Jeff Layton
2015-11-23 9:50 ` Michal Hocko
2015-11-23 11:50 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox