All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Paul Burton" <pburton@wavecomp.com>,
	"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	qemu-arm@nongnu.org, "David Gibson" <david@gibson.dropbear.id.au>,
	qemu-riscv@nongnu.org,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
	"Jean-Christophe Dubois" <jcd@tribudubois.net>,
	qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code
Date: Fri, 27 Mar 2020 00:49:46 +0200	[thread overview]
Message-ID: <CAHiYmc59pEf=-couqAVKcSvCOwOJ2igvcFFWSRVDiDMhZjk36w@mail.gmail.com> (raw)
In-Reply-To: <20200325191830.16553-10-f4bug@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 2904 bytes --]

21:19 Sre, 25.03.2020. Philippe Mathieu-Daudé <f4bug@amsat.org> је
написао/ла:
>
> Running the coccinelle script produced:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file
scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --dir hw
>
>   [[manual check required: error_propagate() might be missing in
object_property_set_int() hw/mips/mips_malta.c:1193:4]]
>   [[manual check required: error_propagate() might be missing in
object_property_set_str() hw/mips/mips_malta.c:1192:4]]
>
> Add the missing error_propagate() after manual review by adding
> a Error* parameter to create_cps().
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/mips_malta.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index e4c4de1b4e..8d43cfd41b 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1183,22 +1183,31 @@ static void create_cpu_without_cps(MachineState
*ms,
>  }
>
>  static void create_cps(MachineState *ms, MaltaState *s,
> -                       qemu_irq *cbus_irq, qemu_irq *i8259_irq)
> +                       qemu_irq *cbus_irq, qemu_irq *i8259_irq,
> +                       Error **errp)
>  {
>      Error *err = NULL;
>
>      sysbus_init_child_obj(OBJECT(s), "cps", OBJECT(&s->cps),
sizeof(s->cps),
>                            TYPE_MIPS_CPS);
>      object_property_set_str(OBJECT(&s->cps), ms->cpu_type, "cpu-type",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->cps), ms->smp.cpus, "num-vp",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
> -    if (err != NULL) {
> -        error_report("%s", error_get_pretty(err));
> -        exit(1);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
>      }
>
>      sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
>
>      *i8259_irq = get_cps_irq(&s->cps, 3);
>      *cbus_irq = NULL;
>  }
> @@ -1206,9 +1215,9 @@ static void create_cps(MachineState *ms, MaltaState
*s,
>  static void mips_create_cpu(MachineState *ms, MaltaState *s,
>                              qemu_irq *cbus_irq, qemu_irq *i8259_irq)
>  {
>      if ((ms->smp.cpus > 1) && cpu_supports_cps_smp(ms->cpu_type)) {
> -        create_cps(ms, s, cbus_irq, i8259_irq);
> +        create_cps(ms, s, cbus_irq, i8259_irq, &error_fatal);
>      } else {
>          create_cpu_without_cps(ms, cbus_irq, i8259_irq);
>      }
>  }
> --
> 2.21.1
>

Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>

[-- Attachment #2: Type: text/html, Size: 3894 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Paul Burton" <pburton@wavecomp.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	qemu-ppc@nongnu.org, "Jason Wang" <jasowang@redhat.com>,
	"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
	"Richard Henderson" <rth@twiddle.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	qemu-arm@nongnu.org, qemu-riscv@nongnu.org,
	"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
	"Jean-Christophe Dubois" <jcd@tribudubois.net>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>
Subject: Re: [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code
Date: Fri, 27 Mar 2020 00:49:46 +0200	[thread overview]
Message-ID: <CAHiYmc59pEf=-couqAVKcSvCOwOJ2igvcFFWSRVDiDMhZjk36w@mail.gmail.com> (raw)
In-Reply-To: <20200325191830.16553-10-f4bug@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 2904 bytes --]

21:19 Sre, 25.03.2020. Philippe Mathieu-Daudé <f4bug@amsat.org> је
написао/ла:
>
> Running the coccinelle script produced:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file
scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --dir hw
>
>   [[manual check required: error_propagate() might be missing in
object_property_set_int() hw/mips/mips_malta.c:1193:4]]
>   [[manual check required: error_propagate() might be missing in
object_property_set_str() hw/mips/mips_malta.c:1192:4]]
>
> Add the missing error_propagate() after manual review by adding
> a Error* parameter to create_cps().
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/mips_malta.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index e4c4de1b4e..8d43cfd41b 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1183,22 +1183,31 @@ static void create_cpu_without_cps(MachineState
*ms,
>  }
>
>  static void create_cps(MachineState *ms, MaltaState *s,
> -                       qemu_irq *cbus_irq, qemu_irq *i8259_irq)
> +                       qemu_irq *cbus_irq, qemu_irq *i8259_irq,
> +                       Error **errp)
>  {
>      Error *err = NULL;
>
>      sysbus_init_child_obj(OBJECT(s), "cps", OBJECT(&s->cps),
sizeof(s->cps),
>                            TYPE_MIPS_CPS);
>      object_property_set_str(OBJECT(&s->cps), ms->cpu_type, "cpu-type",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->cps), ms->smp.cpus, "num-vp",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
> -    if (err != NULL) {
> -        error_report("%s", error_get_pretty(err));
> -        exit(1);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
>      }
>
>      sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
>
>      *i8259_irq = get_cps_irq(&s->cps, 3);
>      *cbus_irq = NULL;
>  }
> @@ -1206,9 +1215,9 @@ static void create_cps(MachineState *ms, MaltaState
*s,
>  static void mips_create_cpu(MachineState *ms, MaltaState *s,
>                              qemu_irq *cbus_irq, qemu_irq *i8259_irq)
>  {
>      if ((ms->smp.cpus > 1) && cpu_supports_cps_smp(ms->cpu_type)) {
> -        create_cps(ms, s, cbus_irq, i8259_irq);
> +        create_cps(ms, s, cbus_irq, i8259_irq, &error_fatal);
>      } else {
>          create_cpu_without_cps(ms, cbus_irq, i8259_irq);
>      }
>  }
> --
> 2.21.1
>

Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>

[-- Attachment #2: Type: text/html, Size: 3894 bytes --]

  parent reply	other threads:[~2020-03-26 22:51 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
2020-03-25 19:18 ` Philippe Mathieu-Daudé
2020-03-25 19:18 ` [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:32   ` Peter Maydell
2020-03-26 21:32     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:34   ` Peter Maydell
2020-03-26 21:34     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 03/12] hw/arm/fsl-imx: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:35   ` Peter Maydell
2020-03-26 21:35     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-25 20:51   ` Alistair Francis
2020-03-25 20:51     ` Alistair Francis
2020-03-26 21:45   ` Peter Maydell
2020-03-26 21:45     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 05/12] hw/i386/x86: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:38   ` Peter Maydell
2020-03-26 21:38     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-25 20:52   ` Alistair Francis
2020-03-25 20:52     ` Alistair Francis
2020-03-26 21:46   ` Peter Maydell
2020-03-26 21:46     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 07/12] hw/mips/cps: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:43   ` Peter Maydell
2020-03-26 21:43     ` Peter Maydell
2020-03-26 22:48   ` Aleksandar Markovic
2020-03-26 22:48     ` Aleksandar Markovic
2020-03-25 19:18 ` [PATCH-for-5.0 08/12] hw/mips/boston: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:47   ` Peter Maydell
2020-03-26 21:47     ` Peter Maydell
2020-03-26 22:50   ` Aleksandar Markovic
2020-03-26 22:50     ` Aleksandar Markovic
2020-03-25 19:18 ` [PATCH-for-5.0 09/12] hw/mips/mips_malta: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-26 21:49   ` Peter Maydell
2020-03-26 21:49     ` Peter Maydell
2020-03-26 22:49   ` Aleksandar Markovic [this message]
2020-03-26 22:49     ` Aleksandar Markovic
2020-03-25 19:18 ` [PATCH-for-5.0 10/12] hw/misc/macio/macio: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-25 23:55   ` David Gibson
2020-03-25 23:55     ` David Gibson
2020-03-26 21:50   ` Peter Maydell
2020-03-26 21:50     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-25 20:52   ` Alistair Francis
2020-03-25 20:52     ` Alistair Francis
2020-03-26 21:51   ` Peter Maydell
2020-03-26 21:51     ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 12/12] hw/riscv/sifive_u: " Philippe Mathieu-Daudé
2020-03-25 19:18   ` Philippe Mathieu-Daudé
2020-03-25 20:52   ` Alistair Francis
2020-03-25 20:52     ` Alistair Francis
2020-03-26 21:55   ` Peter Maydell
2020-03-26 21:55     ` Peter Maydell
2020-03-31 17:02     ` Philippe Mathieu-Daudé
2020-03-31 17:02       ` Philippe Mathieu-Daudé
2020-03-31 17:03       ` Peter Maydell
2020-03-31 17:03         ` Peter Maydell
2020-03-25 19:20 ` [PATCH-for-5.0 00/12] hw: " Philippe Mathieu-Daudé
2020-03-25 19:20   ` Philippe Mathieu-Daudé
2020-03-30  9:21   ` Stefan Hajnoczi
2020-03-30  9:21     ` Stefan Hajnoczi
2020-04-06 17:47     ` Philippe Mathieu-Daudé
2020-04-06 17:47       ` Philippe Mathieu-Daudé
2020-03-31 13:23 ` Markus Armbruster
2020-03-31 13:23   ` Markus Armbruster
2020-04-03 17:53   ` Philippe Mathieu-Daudé
2020-04-03 17:53     ` Philippe Mathieu-Daudé
2020-04-04  5:55     ` Markus Armbruster
2020-04-04  5:55       ` Markus Armbruster

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='CAHiYmc59pEf=-couqAVKcSvCOwOJ2igvcFFWSRVDiDMhZjk36w@mail.gmail.com' \
    --to=aleksandar.qemu.devel@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=Andrew.Baumann@microsoft.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=alistair@alistair23.me \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=jasowang@redhat.com \
    --cc=jcd@tribudubois.net \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=pburton@wavecomp.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sagark@eecs.berkeley.edu \
    /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.