Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131AbbL0Gjo (ORCPT ); Sun, 27 Dec 2015 01:39:44 -0500 Received: from mail-yk0-f194.google.com ([209.85.160.194]:34065 "EHLO mail-yk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbbL0Gjn (ORCPT ); Sun, 27 Dec 2015 01:39:43 -0500 From: Joshua Clayton To: Al Viro , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Oleg Drokin , Andreas Dilger , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org Subject: [PATCH v2] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Date: Sat, 26 Dec 2015 22:39:31 -0800 Message-ID: <2945911.XxDChhFj7Z@diplodocus> User-Agent: KMail/4.14.10 (Linux/4.4.0-rc5-next-20151221-dirty; KDE/4.14.15; x86_64; ; ) In-Reply-To: <20151227054117.GG20997@ZenIV.linux.org.uk> References: <1451193162-20057-1-git-send-email-stillcompiling@gmail.com> <20151227054117.GG20997@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1684 Lines: 51 running sparse on drivers/staging/lustre results in dozens of warnings: include/linux/gfp.h:281:41: warning: odd constant _Bool cast (400000 becomes 1) Use "!!" to explicitly convert to bool and get rid of the warning. Signed-off-by: Joshua Clayton --- On Sunday, December 27, 2015 05:41:17 AM Al Viro wrote: > On Sat, Dec 26, 2015 at 09:12:42PM -0800, Joshua Clayton wrote: > > running sparse on drivers/staging/lustre results in dozens of warnings: > > include/linux/gfp.h:281:41: warning: > > odd constant _Bool cast (400000 becomes 1) > > > > Use "!!" to explicitly convert the result to bool range. > > ... and the cast to bool is left in order to...? > > > - return (bool __force)(gfp_flags & __GFP_DIRECT_RECLAIM); > > + return (bool __force)!!(gfp_flags & __GFP_DIRECT_RECLAIM); to embarrass me, I suppose. :( I didn't think about the redundancy of the cast. Lets try that again. 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 91f74e7..28ad5f6 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -278,7 +278,7 @@ static inline int gfpflags_to_migratetype(const gfp_t gfp_flags) static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) { - return (bool __force)(gfp_flags & __GFP_DIRECT_RECLAIM); + return !!(gfp_flags & __GFP_DIRECT_RECLAIM); } #ifdef CONFIG_HIGHMEM -- 2.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/