All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: eranian@googlemail.com
Cc: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
	mingo@elte.hu, paulus@samba.org, perfmon2-devel@lists.sf.net
Subject: [PATCH] perf: fix cmpxchg warning in perf_event_amd.c
Date: Tue, 18 May 2010 16:43:30 -0400	[thread overview]
Message-ID: <20100518204330.GA30624@redhat.com> (raw)

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


             reply	other threads:[~2010-05-18 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 20:43 Jason Baron [this message]
2010-05-19  6:32 ` [PATCH] perf: fix cmpxchg warning in perf_event_amd.c Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100518204330.GA30624@redhat.com \
    --to=jbaron@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=eranian@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.