Skip to contentSkip to conversation

fs/super.c: use && instead of & for warn_on condition

PATCH In review Vincent Stehlé 3 participants 3 messages Sep 21, 2015 – Dec 8, 2015 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/super.c: use && instead of & for warn_on condition

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.

---
 fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/super.c +1 -1
index 954aeb8..7ea56de 100644
@@ -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);
Signature · 1 line
2.5.1
Acked-by on v1 1/1
#1 lore raw

fs/super.c int __sb_start_write(struct super_block *sb, int level, bool wait) · line 1202

Quoted 9 lines · Vincent Stehl�
fs/super.c +1 -1
@@ -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.

#2 lore raw
Quoted 6 lines · Oleg Nesterov
Quoted 6 lines
fs/super.c +0 -0
@@ -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);
 
Quoted 7 lines

fs/super.c int __sb_start_write(struct super_block *sb, int level, bool wait) · line 1202

Quoted 2 lines
fs/super.c +1 -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.

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

Signature · 2 lines
Jiri Kosina
SUSE Labs