All of lore.kernel.org
 help / color / mirror / Atom feed
From: chaihaoyu <chaihaoyu1@huawei.com>
To: <qemu-devel@nongnu.org>, <pbonzini@redhat.com>,
	Peter Xu <peterx@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: alex.chen@huawei.com, hunongda@huawei.com
Subject: [PATCH v2 2/5] softmmu: braces {} are needed for if statement
Date: Fri, 15 Jan 2021 11:56:36 +0800	[thread overview]
Message-ID: <ccc5bed3-0614-da43-8260-8b3a341bbb2a@huawei.com> (raw)
In-Reply-To: <aaa530f5-b7ec-3198-a80b-efb88de20c6c@huawei.com>

This patch fixes error messages found by checkpatch.pl:
braces {} are needed for if statement

Signed-off-by: Haoyu Chai <chaihaoyu1@huawei.com>

---
 softmmu/cpus.c         |  6 ++++--
 softmmu/dma-helpers.c  |  3 ++-
 softmmu/memory.c       |  3 ++-
 softmmu/physmem.c      | 15 ++++++++++-----
 softmmu/qdev-monitor.c | 12 ++++++++----
 5 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 1dc20b9dc3..0d16855543 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -744,8 +744,9 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,

     while (size != 0) {
         l = sizeof(buf);
-        if (l > size)
+        if (l > size) {
             l = size;
+        }
         if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
             error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64
                              " specified", orig_addr, orig_size);
@@ -778,8 +779,9 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,

     while (size != 0) {
         l = sizeof(buf);
-        if (l > size)
+        if (l > size) {
             l = size;
+        }
         cpu_physical_memory_read(addr, buf, l);
         if (fwrite(buf, 1, l, f) != l) {
             error_setg(errp, QERR_IO_ERROR);
diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c
index 29001b5459..ccea3a7750 100644
--- a/softmmu/dma-helpers.c
+++ b/softmmu/dma-helpers.c
@@ -165,8 +165,9 @@ static void dma_blk_cb(void *opaque, int ret)
                 }
             }
         }
-        if (!mem)
+        if (!mem) {
             break;
+        }
         qemu_iovec_add(&dbs->iov, mem, cur_len);
         dbs->sg_cur_byte += cur_len;
         if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) {
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 2d346b9de4..0ff81def99 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -671,8 +671,9 @@ void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque)
     assert(cb);

     FOR_EACH_FLAT_RANGE(fr, fv) {
-        if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque))
+        if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque)) {
             break;
+        }
     }
 }

diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 6301f4f0a5..43e37660c7 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -797,8 +797,9 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
         tlb_flush(cpu);
     }

-    if (watchpoint)
+    if (watchpoint) {
         *watchpoint = wp;
+    }
     return 0;
 }

@@ -1210,8 +1211,9 @@ void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section)

 void qemu_flush_coalesced_mmio_buffer(void)
 {
-    if (kvm_enabled())
+    if (kvm_enabled()) {
         kvm_flush_coalesced_mmio_buffer();
+    }
 }

 void qemu_mutex_lock_ramlist(void)
@@ -2495,8 +2497,9 @@ static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,
 {
     int idx, eidx;

-    if (start >= TARGET_PAGE_SIZE || end >= TARGET_PAGE_SIZE)
+    if (start >= TARGET_PAGE_SIZE || end >= TARGET_PAGE_SIZE) {
         return -1;
+    }
     idx = SUBPAGE_IDX(start);
     eidx = SUBPAGE_IDX(end);
 #if defined(DEBUG_SUBPAGE)
@@ -3410,11 +3413,13 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
         phys_addr = cpu_get_phys_page_attrs_debug(cpu, page, &attrs);
         asidx = cpu_asidx_from_attrs(cpu, attrs);
         /* if no physical page mapped, return an error */
-        if (phys_addr == -1)
+        if (phys_addr == -1) {
             return -1;
+        }
         l = (page + TARGET_PAGE_SIZE) - addr;
-        if (l > len)
+        if (l > len) {
             l = len;
+        }
         phys_addr += (addr & ~TARGET_PAGE_MASK);
         if (is_write) {
             res = address_space_write_rom(cpu->cpu_ases[asidx].as, phys_addr,
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index a681d6a4e8..8642b2a208 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -182,10 +182,12 @@ static int set_property(void *opaque, const char *name, const char *value,
 {
     Object *obj = opaque;

-    if (strcmp(name, "driver") == 0)
+    if (strcmp(name, "driver") == 0) {
         return 0;
-    if (strcmp(name, "bus") == 0)
+    }
+    if (strcmp(name, "bus") == 0) {
         return 0;
+    }

     if (!object_property_parse(obj, name, value, errp)) {
         return -1;
@@ -683,8 +685,9 @@ static void qbus_print(Monitor *mon, BusState *bus, int indent);
 static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
                              int indent)
 {
-    if (!props)
+    if (!props) {
         return;
+    }
     for (; props->name; props++) {
         char *value;
         char *legacy_name = g_strdup_printf("legacy-%s", props->name);
@@ -769,8 +772,9 @@ static void qbus_print(Monitor *mon, BusState *bus, int indent)

 void hmp_info_qtree(Monitor *mon, const QDict *qdict)
 {
-    if (sysbus_get_default())
+    if (sysbus_get_default()) {
         qbus_print(mon, sysbus_get_default(), 0);
+    }
 }

 void hmp_info_qdm(Monitor *mon, const QDict *qdict)
-- 
2.29.1.59.gf9b6481aed



  parent reply	other threads:[~2021-01-15  3:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  3:52 [PATCH v2 0/5] softmmu: some space-style problems while coding chaihaoyu
2021-01-15  3:55 ` [PATCH v2 1/5] softmmu: fix problems about spaces chaihaoyu
2021-01-15  3:56 ` chaihaoyu [this message]
2021-01-15  3:57 ` [PATCH v2 3/5] softmmu: don't use '#' flag of printf format ('%#') in format strings chaihaoyu
2021-01-15  3:57 ` [PATCH v2 4/5] softmmu: "foo* bar" should be "foo *bar" chaihaoyu
2021-01-15  3:58 ` [PATCH v2 5/5] softmmu: code indent should never use tabs chaihaoyu

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=ccc5bed3-0614-da43-8260-8b3a341bbb2a@huawei.com \
    --to=chaihaoyu1@huawei.com \
    --cc=alex.chen@huawei.com \
    --cc=hunongda@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.