public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: fix cmpxchg warning in perf_event_amd.c
@ 2010-05-18 20:43 Jason Baron
  2010-05-19  6:32 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Baron @ 2010-05-18 20:43 UTC (permalink / raw)
  To: eranian; +Cc: linux-kernel, a.p.zijlstra, mingo, paulus, perfmon2-devel

Hi,

I'm getting the following warnings:

In file included from arch/x86/kernel/cpu/perf_event.c:1343:
arch/x86/kernel/cpu/perf_event_amd.c: In function
‘amd_put_event_constraints’:
arch/x86/kernel/cpu/perf_event_amd.c:167: warning: value computed is not
used

Since cmpxchg returns a value, we need to use it. We can use it to test if its
equal to "event".

thanks,

-Jason

Signed-off-by: Jason Baron <jbaron@redhat.com>
---
 arch/x86/kernel/cpu/perf_event_amd.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 611df11..e13ce4a 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -163,10 +163,8 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
 	 * when we come here
 	 */
 	for (i = 0; i < x86_pmu.num_counters; i++) {
-		if (nb->owners[i] == event) {
-			cmpxchg(nb->owners+i, event, NULL);
+		if (cmpxchg(nb->owners+i, event, NULL) == event)
 			break;
-		}
 	}
 }
 
-- 
1.7.0.1


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

end of thread, other threads:[~2010-05-19  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18 20:43 [PATCH] perf: fix cmpxchg warning in perf_event_amd.c Jason Baron
2010-05-19  6:32 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox