[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v3 18/24] hw/pci-host/pnv_phb3: Move some code from reali
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v3 18/24] hw/pci-host/pnv_phb3: Move some code from realize() to init() |
Date: |
Mon, 13 Apr 2020 00:36:13 +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 on input
updated before realize() to init().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
v3: Typo 'depend of' -> 'depend on' (eblake)
---
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 v3 12/24] hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State, (continued)
- [PATCH-for-5.1 v3 13/24] hw/arm/stm32f205_soc: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 14/24] hw/arm/xlnx-zynqmp: Use single propagate_error() call, Philippe Mathieu-Daudé, 2020/04/12
- [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
- [PATCH-for-5.1 v3 16/24] hw/arm/xlnx-zynqmp: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 17/24] hw/microblaze/xlnx-zynqmp-pmu: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 18/24] hw/pci-host/pnv_phb3: Move some code from realize() to init(),
Philippe Mathieu-Daudé <=
- [PATCH-for-5.1 v3 19/24] hw/riscv/sifive_e: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 20/24] hw/riscv/sifive_u: Use single type_init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 21/24] hw/riscv/sifive_u: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 22/24] hw/riscv/sifive_u: Store MemoryRegion in SiFiveUSoCState, Philippe Mathieu-Daudé, 2020/04/12