Skip to contentSkip to conversation

drivers/connector/cn_queue.c:130: warning: value computed is not used

PATCH Andreas Schwab 3 participants 3 messages May 30, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

There is no point in testing the atomic value if the result is thrown away.

drivers/connector/cn_queue.c +1 -1
index 9f2f00d..05f8ce2 100644
@@ -127,7 +127,7 @@ void cn_queue_del_callback(struct cn_que
 
 	if (found) {
 		cn_queue_free_callback(cbq);
-		atomic_dec_and_test(&dev->refcnt);
+		atomic_dec(&dev->refcnt);
 	}
 }
 

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#1 lore raw
Quoted 2 lines · Andreas Schwab

There is no point in testing the atomic value if the result is thrown away.

It was created to put implicit smp barrier, but it is not needed there. Your patch is correct, thank you.

Quoted 1 line
Quoted 15 lines
drivers/connector/cn_queue.c +1 -1
index 9f2f00d..05f8ce2 100644
@@ -127,7 +127,7 @@ void cn_queue_del_callback(struct cn_que
 
 	if (found) {
 		cn_queue_free_callback(cbq);
-		atomic_dec_and_test(&dev->refcnt);
+		atomic_dec(&dev->refcnt);
 	}
 }
 

Andreas.

Signature · 1 line
	Evgeniy Polyakov
maintainer
#2 lore raw

From: Evgeniy Polyakov <[email protected]>
Date: Tue, 30 May 2006 15:48:38 +0400

Quoted 6 lines · Andreas Schwab
Quoted 2 lines

There is no point in testing the atomic value if the result is thrown away.

It was created to put implicit smp barrier, but it is not needed there. Your patch is correct, thank you.

Right, the *_and_test() variants have SMP barriers which the normal ones do not. So it is not just a matter of giving a return value or not, there are real side effect differences.

Quoted 3 lines
Quoted 1 line

But since you say it doesn't matter I'll apply this.

Thanks!