]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iommu/pamu: WARN when fsl_pamu_probe() is called more than once
authorJoerg Roedel <jroedel@suse.de>
Wed, 9 Aug 2017 14:15:43 +0000 (16:15 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 15 Aug 2017 11:59:34 +0000 (13:59 +0200)
The function probes the PAMU hardware from device-tree
specifications. It initializes global variables and can thus
be only safely called once.

Add a check that that prints a warning when its called more
than once.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/fsl_pamu.c

index a34355fca37a555e5d5df308bd8df69f4a830b47..9ee8e9e161f57b693873860d4d4a81a1ca0c1e8f 100644 (file)
@@ -42,6 +42,8 @@ struct pamu_isr_data {
 static struct paace *ppaact;
 static struct paace *spaact;
 
+static bool probed;                    /* Has PAMU been probed? */
+
 /*
  * Table for matching compatible strings, for device tree
  * guts node, for QorIQ SOCs.
@@ -1033,6 +1035,9 @@ static int fsl_pamu_probe(struct platform_device *pdev)
         * NOTE : All PAMUs share the same LIODN tables.
         */
 
+       if (WARN_ON(probed))
+               return -EBUSY;
+
        pamu_regs = of_iomap(dev->of_node, 0);
        if (!pamu_regs) {
                dev_err(dev, "ioremap of PAMU node failed\n");
@@ -1172,6 +1177,8 @@ static int fsl_pamu_probe(struct platform_device *pdev)
 
        setup_liodns();
 
+       probed = true;
+
        return 0;
 
 error_genpool: