From: Lubomir Rintel <lkundrak@v3.sk>
To: Marc Zyngier <maz@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
linux-kernel@vger.kernel.org, Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH 1/2] irqchip/mmp: Safeguard against multiple root intc initialization
Date: Wed, 19 Feb 2020 09:00:23 +0100 [thread overview]
Message-ID: <20200219080024.4002-2-lkundrak@v3.sk> (raw)
In-Reply-To: <20200219080024.4002-1-lkundrak@v3.sk>
We can only handle one root ICU. Let's warn if someone messes up and adds
multiple in the devicetree.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/irqchip/irq-mmp.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c
index 4a74ac7b7c42e..f597d96409a1f 100644
--- a/drivers/irqchip/irq-mmp.c
+++ b/drivers/irqchip/irq-mmp.c
@@ -250,6 +250,11 @@ void __init icu_init_irq(void)
int irq;
max_icu_nr = 1;
+ if (mmp_icu_base) {
+ pr_err("ICU already initialized\n");
+ return;
+ }
+
mmp_icu_base = ioremap(0xd4282000, 0x1000);
icu_data[0].conf_enable = mmp_conf.conf_enable;
icu_data[0].conf_disable = mmp_conf.conf_disable;
@@ -273,6 +278,11 @@ void __init mmp2_init_icu(void)
int irq, end;
max_icu_nr = 8;
+ if (mmp_icu_base) {
+ pr_err("ICU already initialized\n");
+ return;
+ }
+
mmp_icu_base = ioremap(0xd4282000, 0x1000);
icu_data[0].conf_enable = mmp2_conf.conf_enable;
icu_data[0].conf_disable = mmp2_conf.conf_disable;
@@ -380,6 +390,11 @@ static int __init mmp_init_bases(struct device_node *node)
return ret;
}
+ if (mmp_icu_base) {
+ pr_err("ICU already initialized\n");
+ return -EEXIST;
+ }
+
mmp_icu_base = of_iomap(node, 0);
if (!mmp_icu_base) {
pr_err("Failed to get interrupt controller register\n");
--
2.24.1
next prev parent reply other threads:[~2020-02-19 8:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 8:00 [PATCH 0/2] irqchip/mmp: A pair of robustness fixed Lubomir Rintel
2020-02-19 8:00 ` Lubomir Rintel [this message]
2020-02-19 8:00 ` [PATCH 2/2] irqchip/mmp: Avoid overflowing icu_data[] Lubomir Rintel
2020-03-08 14:04 ` [PATCH 0/2] irqchip/mmp: A pair of robustness fixed Marc Zyngier
2020-03-08 14:46 ` Lubomir Rintel
2020-03-08 17:26 ` Marc Zyngier
2020-03-09 10:10 ` Lubomir Rintel
2020-03-09 16:13 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200219080024.4002-2-lkundrak@v3.sk \
--to=lkundrak@v3.sk \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox