The event buffer does not need to be allocated if something has failed in
setting up event irq's.

In prep for adjusting event configuration for DCD events move the buffer
allocation to the end of the event configuration.

Reviewed-by: Davidlohr Bueso <[email protected]>
Reviewed-by: Dave Jiang <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Fan Ni <[email protected]>
Reviewed-by: Li Ming <[email protected]>
Link: 
https://lore.kernel.org/all/[email protected]/
 [1]
Suggested-by: Dan Williams <[email protected]>
Signed-off-by: Ira Weiny <[email protected]>
---
 drivers/cxl/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index 
188412d45e0d266b19f7401a1cdc51ed6fb0ea0a..295779c433b2a2e377995b53a70ff2a3158b0a8e
 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -764,10 +764,6 @@ static int cxl_event_config(struct pci_host_bridge 
*host_bridge,
                return 0;
        }
 
-       rc = cxl_mem_alloc_event_buf(mds);
-       if (rc)
-               return rc;
-
        rc = cxl_event_get_int_policy(mds, &policy);
        if (rc)
                return rc;
@@ -781,6 +777,10 @@ static int cxl_event_config(struct pci_host_bridge 
*host_bridge,
                return -EBUSY;
        }
 
+       rc = cxl_mem_alloc_event_buf(mds);
+       if (rc)
+               return rc;
+
        rc = cxl_event_irqsetup(mds);
        if (rc)
                return rc;

-- 
2.47.0


Reply via email to