mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
Subsystems (3)
PATCH 1/1 mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
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(-)
include/linux/gfp.h +1 -1
@@ -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
Signature · 7 lines
2.6.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Joshua Clayton
running sparse on
drivers/staging/lustreresults in dozens of warnings:include/linux/gfp.h:281:41: warning:
odd constant_Boolcast (400000 becomes 1)Use "!!" to explicitly convert the result to bool range.
... and the cast to bool is left in order to...?
include/linux/gfp.h static inline int gfpflags_to_migratetype(const gfp_t gfp_flags) · line 281
Quoted 2 lines
include/linux/gfp.h +1
-1-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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 1/1 mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
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.
---
Quoted 11 lines · Al Viro
Quoted 5 lines · Joshua Clayton
running sparse on
drivers/staging/lustreresults in dozens of warnings:include/linux/gfp.h:281:41: warning:
odd constant_Boolcast (400000 becomes 1)Use "!!" to explicitly convert the result to bool range.
... and the cast to bool is left in order to...?
Review
Quoted 2 lines
(quoted diff) +1
-1- 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(-)
include/linux/gfp.h +1 -1
@@ -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
Signature · 9 lines
2.6.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Joshua Clayton
running sparse on
drivers/staging/lustreresults in dozens of warnings:include/linux/gfp.h:281:41: warning:
odd constant_Boolcast (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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Sudip Mukherjee
Quoted 4 lines · Joshua Clayton
running sparse on
drivers/staging/lustreresults in dozens of warnings:include/linux/gfp.h:281:41: warning:
odd constant_Boolcast (400000 becomes 1)
Quoted 7 lines
Quoted 2 lines
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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>