]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
migration: Use cmpxchg correctly
authorJuan Quintela <quintela@redhat.com>
Wed, 17 Jun 2015 00:06:20 +0000 (02:06 +0200)
committerJuan Quintela <quintela@redhat.com>
Tue, 7 Jul 2015 12:54:53 +0000 (14:54 +0200)
cmpxchg returns the old value

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
migration/migration.c

index edb4f3ee92bc0d346b3cd5aadd0a75f890bc5743..1e34aa5f207dbf9878a4295732ccda7da297eac6 100644 (file)
@@ -509,7 +509,7 @@ void qmp_migrate_set_parameters(bool has_compress_level,
 
 static void migrate_set_state(MigrationState *s, int old_state, int new_state)
 {
-    if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
+    if (atomic_cmpxchg(&s->state, old_state, new_state) == old_state) {
         trace_migrate_set_state(new_state);
     }
 }