linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
@ 2015-12-27  5:12 Joshua Clayton
  2015-12-27  5:41 ` Al Viro
  2015-12-30  4:47 ` [PATCH] " Sudip Mukherjee
  0 siblings, 2 replies; 5+ messages in thread
From: Joshua Clayton @ 2015-12-27  5:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Greg Kroah-Hartman, Oleg Drokin,
	Andreas Dilger, lustre-devel, devel, Joshua Clayton

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.
---
 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..6e58a8f 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 (bool __force)!!(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>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
  2015-12-27  5:12 [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Joshua Clayton
@ 2015-12-27  5:41 ` Al Viro
  2015-12-27  6:39   ` [PATCH v2] " Joshua Clayton
  2015-12-30  4:47 ` [PATCH] " Sudip Mukherjee
  1 sibling, 1 reply; 5+ messages in thread
From: Al Viro @ 2015-12-27  5:41 UTC (permalink / raw)
  To: Joshua Clayton
  Cc: Andrew Morton, linux-mm, linux-kernel, Greg Kroah-Hartman,
	Oleg Drokin, Andreas Dilger, lustre-devel, devel

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 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] 5+ messages in thread

* [PATCH v2] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
  2015-12-27  5:41 ` Al Viro
@ 2015-12-27  6:39   ` Joshua Clayton
  0 siblings, 0 replies; 5+ messages in thread
From: Joshua Clayton @ 2015-12-27  6:39 UTC (permalink / raw)
  To: Al Viro, Andrew Morton
  Cc: linux-mm, linux-kernel, Greg Kroah-Hartman, Oleg Drokin,
	Andreas Dilger, lustre-devel, devel

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>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
  2015-12-27  5:12 [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Joshua Clayton
  2015-12-27  5:41 ` Al Viro
@ 2015-12-30  4:47 ` Sudip Mukherjee
  2015-12-30  4:54   ` Joshua Clayton
  1 sibling, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2015-12-30  4:47 UTC (permalink / raw)
  To: Joshua Clayton
  Cc: Andrew Morton, devel, Andreas Dilger, Greg Kroah-Hartman,
	linux-kernel, Oleg Drokin, linux-mm, lustre-devel

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.
> ---

Signed-off-by missing.

regards
sudip

--
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] 5+ messages in thread

* Re: [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
  2015-12-30  4:47 ` [PATCH] " Sudip Mukherjee
@ 2015-12-30  4:54   ` Joshua Clayton
  0 siblings, 0 replies; 5+ messages in thread
From: Joshua Clayton @ 2015-12-30  4:54 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Andrew Morton, devel, Andreas Dilger, Greg Kroah-Hartman,
	linux-kernel, Oleg Drokin, linux-mm, lustre-devel

On Wednesday, December 30, 2015 10:17:50 AM Sudip Mukherjee 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.
> > ---
> 
> Signed-off-by missing.
> 
> regards
> sudip
Hmm. I must have forgotten the "-s" in git send-email
I'm thinking a patch this size wouldn't qualify for copyright even if an Oracle
Lawyer claimed it.
Nevertheless, all is well. The SOB made it into v2.

--
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] 5+ messages in thread

end of thread, other threads:[~2015-12-30  4:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-27  5:12 [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Joshua Clayton
2015-12-27  5:41 ` Al Viro
2015-12-27  6:39   ` [PATCH v2] " Joshua Clayton
2015-12-30  4:47 ` [PATCH] " Sudip Mukherjee
2015-12-30  4:54   ` Joshua Clayton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).