From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753404AbbKWLui (ORCPT ); Mon, 23 Nov 2015 06:50:38 -0500 Received: from mail-qg0-f53.google.com ([209.85.192.53]:34831 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbbKWLuh (ORCPT ); Mon, 23 Nov 2015 06:50:37 -0500 Date: Mon, 23 Nov 2015 06:50:33 -0500 From: Jeff Layton To: Michal Hocko Cc: Andrew Morton , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: fix up sparse warning in gfpflags_allow_blocking Message-ID: <20151123065033.0a8bdc00@tlielax.poochiereds.net> In-Reply-To: <20151123095048.GB21436@dhcp22.suse.cz> References: <1448030459-20990-1-git-send-email-jeff.layton@primarydata.com> <20151123095048.GB21436@dhcp22.suse.cz> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Nov 2015 10:50:49 +0100 Michal Hocko 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 > > Signed-off-by: Jeff Layton > > --- > > 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