public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix sparse warning in kmem_shake_allow
@ 2007-07-14 16:06 Christoph Hellwig
  2007-07-14 16:39 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2007-07-14 16:06 UTC (permalink / raw)
  To: xfs

We can't returned a masked result of a __bitwise type.  Compare it to
0 first to keep the behaviour without the warning.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/kmem.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/kmem.h	2007-07-14 16:00:28.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/linux-2.6/kmem.h	2007-07-14 16:00:38.000000000 +0200
@@ -103,7 +103,7 @@ extern void *kmem_zone_zalloc(kmem_zone_
 static inline int
 kmem_shake_allow(gfp_t gfp_mask)
 {
-	return (gfp_mask & __GFP_WAIT);
+	return (gfp_mask & __GFP_WAIT) != 0;
 }
 
 #endif /* __XFS_SUPPORT_KMEM_H__ */

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

* Re: [PATCH] fix sparse warning in kmem_shake_allow
  2007-07-14 16:06 [PATCH] fix sparse warning in kmem_shake_allow Christoph Hellwig
@ 2007-07-14 16:39 ` Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2007-07-14 16:39 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

Christoph Hellwig wrote:
> We can't returned a masked result of a __bitwise type.  Compare it to
> 0 first to keep the behaviour without the warning.
> 

I wonder if this warrants a comment about sparse to keep it
from disappearing again later...

-Eric

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/kmem.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/kmem.h	2007-07-14 16:00:28.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/kmem.h	2007-07-14 16:00:38.000000000 +0200
> @@ -103,7 +103,7 @@ extern void *kmem_zone_zalloc(kmem_zone_
>  static inline int
>  kmem_shake_allow(gfp_t gfp_mask)
>  {
> -	return (gfp_mask & __GFP_WAIT);
> +	return (gfp_mask & __GFP_WAIT) != 0;
>  }
>  
>  #endif /* __XFS_SUPPORT_KMEM_H__ */
> 
> 

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

end of thread, other threads:[~2007-07-14 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 16:06 [PATCH] fix sparse warning in kmem_shake_allow Christoph Hellwig
2007-07-14 16:39 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox