qemu-block
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]