[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] hw/ppc/spapr: Do not declare local variable only used fo
From: |
Greg Kurz |
Subject: |
Re: [PATCH 3/5] hw/ppc/spapr: Do not declare local variable only used for assertion |
Date: |
Wed, 2 Sep 2020 11:00:22 +0200 |
On Wed, 2 Sep 2020 10:07:59 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 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>
> ---
Same remarks as patch 2/5.
> 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;
- Re: [PATCH 1/5] tests/qtest/ipmi-kcs: Fix assert side-effect, (continued)