linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/super.c: use && instead of & for warn_on condition
@ 2015-09-21 15:18 Vincent Stehlé
  2015-09-21 15:40 ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Stehlé @ 2015-09-21 15:18 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Vincent Stehlé,
	Oleg Nesterov, Alexander Viro, trivial

This fixes the following sparse warning:

  fs/super.c:1202:9: warning: dubious: x & !y

Bitwise and logical and are equivalent here, but logical was intended.
The generated code is identical, with and without CONFIG_LOCKDEP.

Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: trivial@kernel.org
---
 fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 954aeb8..7ea56de 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1199,7 +1199,7 @@ int __sb_start_write(struct super_block *sb, int level, bool wait)
 	else
 		ret = percpu_down_read_trylock(sb->s_writers.rw_sem + level-1);
 
-	WARN_ON(force_trylock & !ret);
+	WARN_ON(force_trylock && !ret);
 	return ret;
 }
 EXPORT_SYMBOL(__sb_start_write);
-- 
2.5.1


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

* Re: [PATCH] fs/super.c: use && instead of & for warn_on condition
  2015-09-21 15:18 [PATCH] fs/super.c: use && instead of & for warn_on condition Vincent Stehlé
@ 2015-09-21 15:40 ` Oleg Nesterov
  2015-12-08 13:51   ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2015-09-21 15:40 UTC (permalink / raw)
  To: Vincent Stehlé; +Cc: linux-fsdevel, linux-kernel, Alexander Viro, trivial

On 09/21, Vincent Stehlé wrote:
>
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1199,7 +1199,7 @@ int __sb_start_write(struct super_block *sb, int level, bool wait)
>  	else
>  		ret = percpu_down_read_trylock(sb->s_writers.rw_sem + level-1);
>
> -	WARN_ON(force_trylock & !ret);
> +	WARN_ON(force_trylock && !ret);

OOPS! yes, this is a typo, thanks! Harmless in this particular case,
but still.

Acked-by: Oleg Nesterov <oleg@redhat.com>


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

* Re: [PATCH] fs/super.c: use && instead of & for warn_on condition
  2015-09-21 15:40 ` Oleg Nesterov
@ 2015-12-08 13:51   ` Jiri Kosina
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2015-12-08 13:51 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Vincent Stehlé, linux-fsdevel, linux-kernel, Alexander Viro

On Mon, 21 Sep 2015, Oleg Nesterov wrote:

> > --- a/fs/super.c
> > +++ b/fs/super.c
> > @@ -1199,7 +1199,7 @@ int __sb_start_write(struct super_block *sb, int level, bool wait)
> >  	else
> >  		ret = percpu_down_read_trylock(sb->s_writers.rw_sem + level-1);
> >
> > -	WARN_ON(force_trylock & !ret);
> > +	WARN_ON(force_trylock && !ret);
> 
> OOPS! yes, this is a typo, thanks! Harmless in this particular case,
> but still.
> 
> Acked-by: Oleg Nesterov <oleg@redhat.com>

Doesn't seem to be in linux-next as of today, so I am taking it now. 
Thanks,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2015-12-08 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-21 15:18 [PATCH] fs/super.c: use && instead of & for warn_on condition Vincent Stehlé
2015-09-21 15:40 ` Oleg Nesterov
2015-12-08 13:51   ` Jiri Kosina

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