All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Corey Minyard" <minyard@acm.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-trivial@nongnu.org, qemu-ppc@nongnu.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH 3/5] hw/ppc/spapr: Do not declare local variable only used for assertion
Date: Wed,  2 Sep 2020 10:07:59 +0200	[thread overview]
Message-ID: <20200902080801.160652-4-philmd@redhat.com> (raw)
In-Reply-To: <20200902080801.160652-1-philmd@redhat.com>

This variable is used once in an assertion. Remove single
declaration and access directly in the assert().

See in "qemu/osdep.h":

 *                                  [...] disable assertion is not
 * supported upstream so the risk is all yours.  Meanwhile, please
 * submit patches to remove any side-effects inside an assertion, or
 * fixing error handling that should use Error instead of assert.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/ppc/spapr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index dd2fa4826b3..6447a5b3808 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -628,7 +628,6 @@ static int spapr_dt_dynamic_reconfiguration_memory(SpaprMachineState *spapr,
 static int spapr_dt_memory(SpaprMachineState *spapr, void *fdt)
 {
     MachineState *machine = MACHINE(spapr);
-    SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
     hwaddr mem_start, node_size;
     int i, nb_nodes = machine->numa_state->num_nodes;
     NodeInfo *nodes = machine->numa_state->nodes;
@@ -670,7 +669,7 @@ static int spapr_dt_memory(SpaprMachineState *spapr, void *fdt)
     if (spapr_ovec_test(spapr->ov5_cas, OV5_DRCONF_MEMORY)) {
         int ret;
 
-        g_assert(smc->dr_lmb_enabled);
+        g_assert(SPAPR_MACHINE_GET_CLASS(spapr)->dr_lmb_enabled);
         ret = spapr_dt_dynamic_reconfiguration_memory(spapr, fdt);
         if (ret) {
             return ret;
-- 
2.26.2



  parent reply	other threads:[~2020-09-02  8:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02  8:07 [PATCH 0/5] misc: Reduce assert side-effects Philippe Mathieu-Daudé
2020-09-02  8:07 ` [PATCH 1/5] tests/qtest/ipmi-kcs: Fix assert side-effect Philippe Mathieu-Daudé
2020-09-02  8:50   ` Greg Kurz
2020-09-02  9:54   ` Thomas Huth
2020-09-02  8:07 ` [PATCH 2/5] hw/pci-bridge: Do not declare local variable only used for assertion Philippe Mathieu-Daudé
2020-09-02  8:59   ` Greg Kurz
2020-09-02  8:07 ` Philippe Mathieu-Daudé [this message]
2020-09-02  9:00   ` [PATCH 3/5] hw/ppc/spapr: " Greg Kurz
2020-09-02  8:08 ` [PATCH 4/5] tcg/tcg: " Philippe Mathieu-Daudé
2020-09-02  9:02   ` Greg Kurz
2020-09-02  8:08 ` [PATCH 5/5] util/qsp: " Philippe Mathieu-Daudé
2020-09-02  9:11   ` Greg Kurz
2020-09-02  9:53     ` Philippe Mathieu-Daudé

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=20200902080801.160652-4-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=minyard@acm.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /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.