Skip to content

Commit 66a535c

Browse files
seehearfeelMarc Zyngier
authored andcommitted
irqchip/loongson-pch-pic: Check return value of irq_domain_translate_twocell()
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: ef8c01e ("irqchip: Add Loongson PCH PIC controller") Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent dbec370 commit 66a535c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/irqchip/irq-loongson-pch-pic.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,19 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq,
135135
int err;
136136
unsigned int type;
137137
unsigned long hwirq;
138-
struct irq_fwspec fwspec;
138+
struct irq_fwspec *fwspec = arg;
139+
struct irq_fwspec parent_fwspec;
139140
struct pch_pic *priv = domain->host_data;
140141

141-
irq_domain_translate_twocell(domain, arg, &hwirq, &type);
142+
err = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
143+
if (err)
144+
return err;
142145

143-
fwspec.fwnode = domain->parent->fwnode;
144-
fwspec.param_count = 1;
145-
fwspec.param[0] = hwirq + priv->ht_vec_base;
146+
parent_fwspec.fwnode = domain->parent->fwnode;
147+
parent_fwspec.param_count = 1;
148+
parent_fwspec.param[0] = hwirq + priv->ht_vec_base;
146149

147-
err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
150+
err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec);
148151
if (err)
149152
return err;
150153

0 commit comments

Comments
 (0)