From: Joshua Clayton <stillcompiling@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
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 [thread overview]
Message-ID: <2945911.XxDChhFj7Z@diplodocus> (raw)
In-Reply-To: <20151227054117.GG20997@ZenIV.linux.org.uk>
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 <stillcompiling@gmail.com>
---
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, 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>
next prev parent reply other threads:[~2015-12-27 6:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-27 5:12 [PATCH] " Joshua Clayton
2015-12-27 5:41 ` Al Viro
2015-12-27 6:39 ` Joshua Clayton [this message]
2015-12-30 4:47 ` Sudip Mukherjee
2015-12-30 4:54 ` Joshua Clayton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2945911.XxDChhFj7Z@diplodocus \
--to=stillcompiling@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox