All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <maz@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PATCH v3 5/8] irqchip/loongson-pch-pic: Check return value of irq_domain_translate_twocell()
Date: Tue,  7 Jul 2020 10:12:49 +0800	[thread overview]
Message-ID: <1594087972-21715-6-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1594087972-21715-1-git-send-email-yangtiezhu@loongson.cn>

Check the return value of irq_domain_translate_twocell() due to
it may returns -EINVAL if failed and use variable fwspec for it,
and then use a new variable parent_fwspec which is proper for
irq_domain_alloc_irqs_parent().

Fixes: ef8c01eb64ca ("irqchip: Add Loongson PCH PIC controller")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 drivers/irqchip/irq-loongson-pch-pic.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
index 2a05b93..016f32c 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -135,16 +135,19 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq,
 	int err;
 	unsigned int type;
 	unsigned long hwirq;
-	struct irq_fwspec fwspec;
+	struct irq_fwspec *fwspec = arg;
+	struct irq_fwspec parent_fwspec;
 	struct pch_pic *priv = domain->host_data;
 
-	irq_domain_translate_twocell(domain, arg, &hwirq, &type);
+	err = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
+	if (err)
+		return err;
 
-	fwspec.fwnode = domain->parent->fwnode;
-	fwspec.param_count = 1;
-	fwspec.param[0] = hwirq + priv->ht_vec_base;
+	parent_fwspec.fwnode = domain->parent->fwnode;
+	parent_fwspec.param_count = 1;
+	parent_fwspec.param[0] = hwirq + priv->ht_vec_base;
 
-	err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
+	err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec);
 	if (err)
 		return err;
 
-- 
2.1.0


  parent reply	other threads:[~2020-07-07  2:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  2:12 [PATCH v3 0/8] irqchip: Fix some issues and do some code cleanups about Loongson Tiezhu Yang
2020-07-07  2:12 ` [PATCH v3 1/8] irqchip/loongson-htpic: Remove redundant kfree operation Tiezhu Yang
2020-07-07  2:12 ` [PATCH v3 2/8] irqchip/loongson-htpic: Remove unneeded select of I8259 Tiezhu Yang
2020-07-07  2:12 ` [PATCH v3 3/8] irqchip/loongson-htvec: Fix potential resource leak Tiezhu Yang
2020-07-07  2:12 ` [PATCH v3 4/8] irqchip/loongson-htvec: Check return value of irq_domain_translate_onecell() Tiezhu Yang
2020-07-07  2:12 ` Tiezhu Yang [this message]
2020-07-07  2:12 ` [PATCH v3 6/8] irqchip/loongson-pch-msi: Remove unneeded variable Tiezhu Yang
2020-07-07  2:12 ` [PATCH v3 7/8] irqchip/loongson-liointc: Fix potential dead lock Tiezhu Yang
2020-07-07  2:12 ` [PATCH v3 8/8] dt-bindings: interrupt-controller: Fix typos in loongson,liointc.yaml Tiezhu Yang
2020-07-13 21:41   ` Rob Herring
2020-07-14  1:39     ` Tiezhu Yang
2020-07-17 12:48 ` [PATCH v3 0/8] irqchip: Fix some issues and do some code cleanups about Loongson Marc Zyngier
2020-07-17 12:48   ` Marc Zyngier

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=1594087972-21715-6-git-send-email-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=jason@lakedaemon.net \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH v3 5/8] irqchip/loongson-pch-pic: Check return value of irq_domain_translate_twocell()' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.