]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bus: fsl-mc-msi: Allocate MSI device data on first use
authorThomas Gleixner <tglx@linutronix.de>
Fri, 10 Dec 2021 22:19:00 +0000 (23:19 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 16 Dec 2021 21:16:38 +0000 (22:16 +0100)
Allocate the MSI device data on first invocation of the allocation function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211210221813.867985931@linutronix.de
drivers/bus/fsl-mc/fsl-mc-msi.c

index cf974870ba55d18c2d3c9b18e4bd61ba535342ed..c6215b7fe27cbe290586fdaaa94dc9c4d17ec1a4 100644 (file)
@@ -253,6 +253,14 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
        struct irq_domain *msi_domain;
        int error;
 
+       msi_domain = dev_get_msi_domain(dev);
+       if (!msi_domain)
+               return -EINVAL;
+
+       error = msi_setup_device_data(dev);
+       if (error)
+               return error;
+
        if (!list_empty(dev_to_msi_list(dev)))
                return -EINVAL;
 
@@ -260,12 +268,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
        if (error < 0)
                return error;
 
-       msi_domain = dev_get_msi_domain(dev);
-       if (!msi_domain) {
-               error = -EINVAL;
-               goto cleanup_msi_descs;
-       }
-
        /*
         * NOTE: Calling this function will trigger the invocation of the
         * its_fsl_mc_msi_prepare() callback