Skip to contentSkip to conversation

bcachefs: remove redundant assignment to variable ret

PATCH In review Colin Ian King 4 participants 7 messages Feb 21, 2024 – Feb 22, 2024 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: remove redundant assignment to variable ret

Variable ret is being assigned a value that is never read, it is being re-assigned a couple of statements later on. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/bcachefs/super-io.c:806:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

---
 fs/bcachefs/super-io.c | 1 -
 1 file changed, 1 deletion(-)
fs/bcachefs/super-io.c +0 -1
index 110dcb0337ce..c6d590404425 100644
@@ -804,7 +804,6 @@ static int __bch2_read_super(const char *path, struct bch_opts *opts,
 		goto err;
 	}
 
-	ret = 0;
 	sb->have_layout = true;
 
 	ret = bch2_sb_validate(sb, &err, READ);
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Colin Ian King

Variable ret is being assigned a value that is never read, it is being re-assigned a couple of statements later on. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/bcachefs/super-io.c:806:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

---

Quoted 18 lines
 fs/bcachefs/super-io.c | 1 -
 1 file changed, 1 deletion(-)
fs/bcachefs/super-io.c +0 -1
index 110dcb0337ce..c6d590404425 100644
@@ -804,7 +804,6 @@ static int __bch2_read_super(const char *path, struct bch_opts *opts,
 		goto err;
 	}
 
-	ret = 0;
 	sb->have_layout = true;
 
 	ret = bch2_sb_validate(sb, &err, READ);
Signature · 1 line
2.39.2
#2 lore raw
In reply to Colin Ian King
Quoted 9 lines · Colin Ian King

Variable ret is being assigned a value that is never read, it is being re-assigned a couple of statements later on. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/bcachefs/super-io.c:806:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

I'll take this, but - entirely too much of the traffic on this list is getting taken up by static analyzer bullshit, we need to cut down on this

#3 lore raw
Quoted 9 lines · Kent Overstreet
Quoted 8 lines · Colin Ian King

Variable ret is being assigned a value that is never read, it is being re-assigned a couple of statements later on. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/bcachefs/super-io.c:806:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

Quoted 5 lines
Quoted 1 line

I'll take this, but - entirely too much of the traffic on this list is getting taken up by static analyzer bullshit, we need to cut down on this

I'll back off then.

Colin

#4 lore raw
Quoted 10 lines · Colin King (gmail)
Quoted 9 lines · Kent Overstreet
Quoted 8 lines · Colin Ian King

Variable ret is being assigned a value that is never read, it is being re-assigned a couple of statements later on. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/bcachefs/super-io.c:806:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'll take this, but - entirely too much of the traffic on this list is getting taken up by static analyzer bullshit, we need to cut down on this

I'll back off then.

Maybe just wrap up fixes for all the warnings every now and then? It is worth keeping up on static analyzer warnings, it's just the mailing list noise I want to cut down on, as well as making better use of my own time.

I'd be happy to take a patch like that now and then, or - maybe we could get a dashboard going, like I was just running by Dan in the other thread? If we could get a dirt simple stupid dashboard that had both the clangc analyzer warnings, and the smatch warnings - I think that would make a lot of people happy.

#5 lore raw

To be honest, the point of explaining how to run Smatch was really to let you know that you're now on your own.

regards,
dan carpenter

#6 lore raw
Quoted 2 lines · Dan Carpenter

To be honest, the point of explaining how to run Smatch was really to let you know that you're now on your own.

Ok that's fine - in that case, I just need to ask you to stop bugging me to get me to explain smatch bugs to you.