Skip to contentSkip to conversation

fix sparse warning in kmem_shake_allow

PATCH In review Christoph Hellwig 2 participants 2 messages Jul 14, 2007 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix sparse warning in kmem_shake_allow

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

fs/xfs/linux-2.6/kmem.h +1 -1
Index: linux-2.6-xfs/fs/xfs/linux-2.6/kmem.h
===================================================================
@@ -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__ */
#1 lore raw
Quoted 3 lines · Christoph Hellwig

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

Quoted 17 lines

Index: linux-2.6-xfs/fs/xfs/linux-2.6/kmem.h
===================================================================

fs/xfs/linux-2.6/kmem.h +1 -1
@@ -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__ */