[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v2 18/54] hw/pci-host/pnv_phb3: Move some code from reali
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v2 18/54] hw/pci-host/pnv_phb3: Move some code from realize() to init() |
Date: |
Mon, 6 Apr 2020 19:47:07 +0200 |
Coccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/pci-host/pnv_phb3.c
>>> possible moves from pnv_phb3_instance_init() to pnv_phb3_realize() in
./hw/pci-host/pnv_phb3.c:992
Move the calls using &error_abort which don't depend of input
updated before realize() to init().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/pci-host/pnv_phb3.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index 74618fadf0..57d717ed23 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -970,6 +970,8 @@ static void pnv_phb3_instance_init(Object *obj)
/* LSI sources */
object_initialize_child(obj, "lsi", &phb->lsis, sizeof(phb->lsis),
TYPE_ICS, &error_abort, NULL);
+ object_property_set_int(OBJECT(&phb->lsis), PNV_PHB3_NUM_LSI, "nr-irqs",
+ &error_abort);
/* Default init ... will be fixed by HW inits */
phb->lsis.offset = 0;
@@ -977,6 +979,8 @@ static void pnv_phb3_instance_init(Object *obj)
/* MSI sources */
object_initialize_child(obj, "msi", &phb->msis, sizeof(phb->msis),
TYPE_PHB3_MSI, &error_abort, NULL);
+ object_property_set_int(OBJECT(&phb->msis), PHB3_MAX_MSI, "nr-irqs",
+ &error_abort);
/* Power Bus Common Queue */
object_initialize_child(obj, "pbcq", &phb->pbcq, sizeof(phb->pbcq),
@@ -1005,8 +1009,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error
**errp)
/* LSI sources */
object_property_set_link(OBJECT(&phb->lsis), OBJECT(pnv), "xics",
&error_abort);
- object_property_set_int(OBJECT(&phb->lsis), PNV_PHB3_NUM_LSI, "nr-irqs",
- &error_abort);
object_property_set_bool(OBJECT(&phb->lsis), true, "realized", &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -1024,8 +1026,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error
**errp)
&error_abort);
object_property_set_link(OBJECT(&phb->msis), OBJECT(pnv), "xics",
&error_abort);
- object_property_set_int(OBJECT(&phb->msis), PHB3_MAX_MSI, "nr-irqs",
- &error_abort);
object_property_set_bool(OBJECT(&phb->msis), true, "realized", &local_err);
if (local_err) {
error_propagate(errp, local_err);
--
2.21.1
- Re: [PATCH-for-5.1 v2 07/54] hw/arm/aspeed_soc: Simplify use of Error*, (continued)
- [PATCH-for-5.1 v2 09/54] hw/arm/fsl-imx6: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 08/54] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 10/54] hw/arm/fsl-imx31: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 13/54] hw/arm/stm32f205_soc: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 11/54] hw/arm/msf2-soc: Store MemoryRegion in MSF2State, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 06/54] hw/arm/aspeed_soc: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 15/54] hw/arm/xlnx-zynqmp: Split xlnx_zynqmp_create_rpu() as init + realize, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 14/54] hw/arm/xlnx-zynqmp: Use single propagate_error() call, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 18/54] hw/pci-host/pnv_phb3: Move some code from realize() to init(),
Philippe Mathieu-Daudé <=
- [PATCH-for-5.1 v2 19/54] hw/riscv/sifive_e: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 20/54] hw/riscv/sifive_u: Use single type_init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 16/54] hw/arm/xlnx-zynqmp: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 17/54] hw/microblaze/xlnx-zynqmp-pmu: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 12/54] hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 21/54] hw/riscv/sifive_u: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 22/54] hw/riscv/sifive_u: Store MemoryRegion in SiFiveUSoCState, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 25/54] scripts/coccinelle: Catch missing error_propagate() calls in realize(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 23/54] hw/riscv/sifive_u: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 24/54] hw/riscv/sifive_u: Rename MachineClass::init(), Philippe Mathieu-Daudé, 2020/04/06