Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1707393
| From | Joerg Roedel <joro@8bytes.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/4] iommu/pamu: WARN when fsl_pamu_probe() is called more than once |
| Date | 2017-08-09 16:50 +0200 |
| Message-ID | <ucAt5-fu-31@gated-at.bofh.it> (permalink) |
| References | <ucAt4-fu-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Joerg Roedel <jroedel@suse.de>
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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index a34355f..9ee8e9e 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -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:
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/4] iommu/pamu: Support generic iommu-device handles Joerg Roedel <joro@8bytes.org> - 2017-08-09 16:50 +0200 [PATCH 4/4] iommu/pamu: Add support for generic iommu-device Joerg Roedel <joro@8bytes.org> - 2017-08-09 16:50 +0200 [PATCH 3/4] iommu/pamu: WARN when fsl_pamu_probe() is called more than once Joerg Roedel <joro@8bytes.org> - 2017-08-09 16:50 +0200
csiph-web