Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298322 > unrolled thread

[PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()

Started byJoshua Clayton <stillcompiling@gmail.com>
First post2015-12-27 06:20 +0100
Last post2015-12-30 06:00 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Joshua Clayton <stillcompiling@gmail.com> - 2015-12-27 06:20 +0100
    Re: [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-27 06:50 +0100
      [PATCH v2] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Joshua Clayton <stillcompiling@gmail.com> - 2015-12-27 07:50 +0100
    Re: [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-30 05:50 +0100
      Re: [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE() Joshua Clayton <stillcompiling@gmail.com> - 2015-12-30 06:00 +0100

#1298322 — [PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()

FromJoshua Clayton <stillcompiling@gmail.com>
Date2015-12-27 06:20 +0100
Subject[PATCH] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
Message-ID<qKbUm-2xo-1@gated-at.bofh.it>
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1298323

FromAl Viro <viro@ZenIV.linux.org.uk>
Date2015-12-27 06:50 +0100
Message-ID<qKcnn-2Pe-3@gated-at.bofh.it>
In reply to#1298322
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298328 — [PATCH v2] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()

FromJoshua Clayton <stillcompiling@gmail.com>
Date2015-12-27 07:50 +0100
Subject[PATCH v2] mm: fix noisy sparse warning in LIBCFS_ALLOC_PRE()
Message-ID<qKdjr-3pN-5@gated-at.bofh.it>
In reply to#1298323
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299231

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-12-30 05:50 +0100
Message-ID<qLgRX-1Iu-3@gated-at.bofh.it>
In reply to#1298322
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299235

FromJoshua Clayton <stillcompiling@gmail.com>
Date2015-12-30 06:00 +0100
Message-ID<qLh1E-1LR-7@gated-at.bofh.it>
In reply to#1299231
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web