qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 13/15] rdma: Simplify var declaration to avoid confusi


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 13/15] rdma: Simplify var declaration to avoid confusing Coccinelle
Date: Tue, 13 Jun 2017 13:53:11 -0300

For some reason the declaration:

  Error *local_err = NULL, **errp = &local_err;

will be matched by Coccinelle even if we use:

  ... when != local_err
  Error *local_err = NULL;
  ... when != local_err

This moves the declarations to separate lines just to avoid that issue.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 migration/rdma.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index c6078bf51b..5cb9572a5c 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2282,7 +2282,8 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
 static int qemu_rdma_source_init(RDMAContext *rdma, bool pin_all, Error **errp)
 {
     int ret, idx;
-    Error *local_err = NULL, **temp = &local_err;
+    Error *local_err = NULL;
+    Error **temp = &local_err;
 
     /*
      * Will be validated against destination's actual capabilities
@@ -3433,7 +3434,8 @@ static int qemu_rdma_registration_start(QEMUFile *f, void 
*opaque,
 static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
                                        uint64_t flags, void *data)
 {
-    Error *local_err = NULL, **errp = &local_err;
+    Error *local_err = NULL;
+    Error **errp = &local_err;
     QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(opaque);
     RDMAContext *rdma = rioc->rdma;
     RDMAControlHeader head = { .len = 0, .repeat = 1 };
@@ -3606,7 +3608,8 @@ static void rdma_accept_incoming_migration(void *opaque)
     RDMAContext *rdma = opaque;
     int ret;
     QEMUFile *f;
-    Error *local_err = NULL, **errp = &local_err;
+    Error *local_err = NULL;
+    Error **errp = &local_err;
 
     trace_qemu_rdma_accept_incoming_migration();
     ret = qemu_rdma_accept(rdma);
-- 
2.11.0.259.g40922b1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]