qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jeff Cody" <codyprime@gmail.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
	qemu-block@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>, "Joel Stanley" <joel@jms.id.au>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Xie Changlong" <xiechanglong.d@gmail.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Beniamino Galvani" <b.galvani@gmail.com>,
	qemu-arm@nongnu.org, "Peter Chubb" <peter.chubb@nicta.com.au>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Kevin Wolf" <kwolf@redhat.com>,
	qemu-riscv@nongnu.org, "Andrew Jeffery" <andrew@aj.id.au>,
	"Wen Congyang" <wencongyang2@huawei.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Jean-Christophe Dubois" <jcd@tribudubois.net>,
	qemu-ppc@nongnu.org,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH-for-5.1 v3 06/24] hw/arm/aspeed_soc: Move some code from realize() to init()
Date: Mon, 13 Apr 2020 00:36:01 +0200	[thread overview]
Message-ID: <20200412223619.11284-7-f4bug@amsat.org> (raw)
In-Reply-To: <20200412223619.11284-1-f4bug@amsat.org>

Coccinelle reported:

  $ spatch ... --timeout 60 --sp-file \
    scripts/coccinelle/simplify-init-realize-error_propagate.cocci
  HANDLING: ./hw/arm/aspeed_soc.c
  >>> possible moves from aspeed_soc_init() to aspeed_soc_realize() in ./hw/arm/aspeed_soc.c:231

Move the calls using &error_fatal which don't depend on input
updated before realize() to init().

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v3: Typo 'depend of' -> 'depend on' (eblake)
---
 hw/arm/aspeed_soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index 696c7fda14..debd7c8faa 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -183,6 +183,7 @@ static void aspeed_soc_init(Object *obj)
         snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i + 1, socname);
         sysbus_init_child_obj(obj, "spi[*]", OBJECT(&s->spi[i]),
                               sizeof(s->spi[i]), typename);
+        object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", &error_abort);
     }
 
     for (i = 0; i < sc->ehcis_num; i++) {
@@ -360,10 +361,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
 
     /* SPI */
     for (i = 0; i < sc->spis_num; i++) {
-        object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", &err);
-        object_property_set_bool(OBJECT(&s->spi[i]), true, "realized",
-                                 &local_err);
-        error_propagate(&err, local_err);
+        object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
-- 
2.21.1



  parent reply	other threads:[~2020-04-12 22:43 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12 22:35 [PATCH-for-5.1 v3 00/24] various: Fix error-propagation with Coccinelle scripts (part 1) Philippe Mathieu-Daudé
2020-04-12 22:35 ` [PATCH-for-5.1 v3 01/24] various: Remove suspicious '\' character outside of #define in C code Philippe Mathieu-Daudé
2020-04-13 15:56   ` Alistair Francis
2020-04-14  2:08   ` David Gibson
2020-04-29  6:03   ` Markus Armbruster
2020-04-12 22:35 ` [PATCH-for-5.1 v3 02/24] scripts/coccinelle: Script to simplify DeviceClass error propagation Philippe Mathieu-Daudé
2020-04-14 12:24   ` Markus Armbruster
2020-04-14 12:30     ` Philippe Mathieu-Daudé
2020-04-14 13:17       ` Markus Armbruster
2020-04-15  6:16         ` Philippe Mathieu-Daudé
2020-04-12 22:35 ` [PATCH-for-5.1 v3 03/24] hw/arm/allwinner-a10: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-13 21:02   ` Philippe Mathieu-Daudé
2020-04-12 22:35 ` [PATCH-for-5.1 v3 04/24] hw/arm/aspeed_ast2600: Simplify use of Error* Philippe Mathieu-Daudé
2020-04-12 22:36 ` [PATCH-for-5.1 v3 05/24] hw/arm/aspeed_ast2600: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-15  7:50   ` Cédric Le Goater
2020-04-12 22:36 ` Philippe Mathieu-Daudé [this message]
2020-04-12 22:36 ` [PATCH-for-5.1 v3 07/24] hw/arm/aspeed_soc: Simplify use of Error* Philippe Mathieu-Daudé
2020-04-12 22:36 ` [PATCH-for-5.1 v3 08/24] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count Philippe Mathieu-Daudé
2020-04-12 22:36 ` [PATCH-for-5.1 v3 09/24] hw/arm/fsl-imx6: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-12 22:36 ` [PATCH-for-5.1 v3 10/24] hw/arm/fsl-imx31: " Philippe Mathieu-Daudé
2020-04-12 22:36 ` [PATCH-for-5.1 v3 11/24] hw/arm/msf2-soc: Store MemoryRegion in MSF2State Philippe Mathieu-Daudé
2020-04-13 21:59   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 12/24] hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State Philippe Mathieu-Daudé
2020-04-13 22:00   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 13/24] hw/arm/stm32f205_soc: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-13 22:02   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 14/24] hw/arm/xlnx-zynqmp: Use single propagate_error() call Philippe Mathieu-Daudé
2020-04-13 22:05   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 15/24] hw/arm/xlnx-zynqmp: Split xlnx_zynqmp_create_rpu() as init + realize Philippe Mathieu-Daudé
2020-04-12 22:36 ` [PATCH-for-5.1 v3 16/24] hw/arm/xlnx-zynqmp: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-13 22:06   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 17/24] hw/microblaze/xlnx-zynqmp-pmu: " Philippe Mathieu-Daudé
2020-04-13 22:19   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 18/24] hw/pci-host/pnv_phb3: " Philippe Mathieu-Daudé
2020-04-14  2:10   ` David Gibson
2020-04-15  7:51   ` Cédric Le Goater
2020-04-12 22:36 ` [PATCH-for-5.1 v3 19/24] hw/riscv/sifive_e: " Philippe Mathieu-Daudé
2020-04-13 22:20   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 20/24] hw/riscv/sifive_u: Use single type_init() Philippe Mathieu-Daudé
2020-04-13 22:10   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 21/24] hw/riscv/sifive_u: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-13 22:16   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 22/24] hw/riscv/sifive_u: Store MemoryRegion in SiFiveUSoCState Philippe Mathieu-Daudé
2020-04-13 22:14   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 23/24] hw/riscv/sifive_u: Move some code from realize() to init() Philippe Mathieu-Daudé
2020-04-13 22:15   ` Alistair Francis
2020-04-12 22:36 ` [PATCH-for-5.1 v3 24/24] hw/riscv/sifive_u: Rename MachineClass::init() Philippe Mathieu-Daudé
2020-04-13 22:14   ` Alistair Francis
2020-04-13  0:39 ` [PATCH-for-5.1 v3 00/24] various: Fix error-propagation with Coccinelle scripts (part 1) no-reply

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=20200412223619.11284-7-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=Alistair.Francis@wdc.com \
    --cc=alistair@alistair23.me \
    --cc=andrew@aj.id.au \
    --cc=armbru@redhat.com \
    --cc=b.galvani@gmail.com \
    --cc=clg@kaod.org \
    --cc=codyprime@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=jasowang@redhat.com \
    --cc=jcd@tribudubois.net \
    --cc=joel@jms.id.au \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.chubb@nicta.com.au \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@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 \
    --cc=sundeep.lkml@gmail.com \
    --cc=wencongyang2@huawei.com \
    --cc=xiechanglong.d@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).