All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/bcm2836: Fix return check in IPI alloc
@ 2020-12-28 22:30 Adam Lackorzynski
  2020-12-29  9:31 ` Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Lackorzynski @ 2020-12-28 22:30 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: maz

__irq_domain_alloc_irqs returns a negative error
code upon failure, not only 0. Also use irq_domain_alloc_irqs
to require less default arguments.

Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
 drivers/irqchip/irq-bcm2836.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index 5f5eb8877c41..853fd420ab2b 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -268,11 +268,10 @@ static void __init bcm2836_arm_irqchip_smp_init(void)
 	ipi_domain->flags |= IRQ_DOMAIN_FLAG_IPI_SINGLE;
 	irq_domain_update_bus_token(ipi_domain, DOMAIN_BUS_IPI);
 
-	base_ipi = __irq_domain_alloc_irqs(ipi_domain, -1, BITS_PER_MBOX,
-					   NUMA_NO_NODE, NULL,
-					   false, NULL);
+	base_ipi = irq_domain_alloc_irqs(ipi_domain, BITS_PER_MBOX,
+					 NUMA_NO_NODE, NULL);
 
-	if (WARN_ON(!base_ipi))
+	if (WARN_ON(base_ipi < 0))
 		return;
 
 	set_smp_ipi_range(base_ipi, BITS_PER_MBOX);
-- 
2.30.0.rc2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] irqchip/bcm2836: Fix return check in IPI alloc
  2020-12-28 22:30 [PATCH] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
@ 2020-12-29  9:31 ` Marc Zyngier
  2020-12-29 23:16   ` Adam Lackorzynski
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2020-12-29  9:31 UTC (permalink / raw)
  To: Adam Lackorzynski; +Cc: linux-arm-kernel

On 2020-12-28 22:30, Adam Lackorzynski wrote:
> __irq_domain_alloc_irqs returns a negative error
> code upon failure, not only 0. Also use irq_domain_alloc_irqs
> to require less default arguments.
> 
> Signed-off-by: Adam Lackorzynski <adam@l4re.org>
> ---
>  drivers/irqchip/irq-bcm2836.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-bcm2836.c 
> b/drivers/irqchip/irq-bcm2836.c
> index 5f5eb8877c41..853fd420ab2b 100644
> --- a/drivers/irqchip/irq-bcm2836.c
> +++ b/drivers/irqchip/irq-bcm2836.c
> @@ -268,11 +268,10 @@ static void __init 
> bcm2836_arm_irqchip_smp_init(void)
>  	ipi_domain->flags |= IRQ_DOMAIN_FLAG_IPI_SINGLE;
>  	irq_domain_update_bus_token(ipi_domain, DOMAIN_BUS_IPI);
> 
> -	base_ipi = __irq_domain_alloc_irqs(ipi_domain, -1, BITS_PER_MBOX,
> -					   NUMA_NO_NODE, NULL,
> -					   false, NULL);
> +	base_ipi = irq_domain_alloc_irqs(ipi_domain, BITS_PER_MBOX,
> +					 NUMA_NO_NODE, NULL);
> 
> -	if (WARN_ON(!base_ipi))
> +	if (WARN_ON(base_ipi < 0))

This is wrong. 0 isn't a valid IRQ number, and should be rejected.

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] irqchip/bcm2836: Fix return check in IPI alloc
  2020-12-29  9:31 ` Marc Zyngier
@ 2020-12-29 23:16   ` Adam Lackorzynski
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Lackorzynski @ 2020-12-29 23:16 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: linux-arm-kernel


On Tue Dec 29, 2020 at 09:31:34 +0000, Marc Zyngier wrote:
> On 2020-12-28 22:30, Adam Lackorzynski wrote:
> > __irq_domain_alloc_irqs returns a negative error
> > code upon failure, not only 0. Also use irq_domain_alloc_irqs
> > to require less default arguments.
> > 
> > Signed-off-by: Adam Lackorzynski <adam@l4re.org>
> > ---
> >  drivers/irqchip/irq-bcm2836.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/irqchip/irq-bcm2836.c
> > b/drivers/irqchip/irq-bcm2836.c
> > index 5f5eb8877c41..853fd420ab2b 100644
> > --- a/drivers/irqchip/irq-bcm2836.c
> > +++ b/drivers/irqchip/irq-bcm2836.c
> > @@ -268,11 +268,10 @@ static void __init
> > bcm2836_arm_irqchip_smp_init(void)
> >  	ipi_domain->flags |= IRQ_DOMAIN_FLAG_IPI_SINGLE;
> >  	irq_domain_update_bus_token(ipi_domain, DOMAIN_BUS_IPI);
> > 
> > -	base_ipi = __irq_domain_alloc_irqs(ipi_domain, -1, BITS_PER_MBOX,
> > -					   NUMA_NO_NODE, NULL,
> > -					   false, NULL);
> > +	base_ipi = irq_domain_alloc_irqs(ipi_domain, BITS_PER_MBOX,
> > +					 NUMA_NO_NODE, NULL);
> > 
> > -	if (WARN_ON(!base_ipi))
> > +	if (WARN_ON(base_ipi < 0))
> 
> This is wrong. 0 isn't a valid IRQ number, and should be rejected.

Thanks, I'll follow up with new versions for more callers.



Adam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-29 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 22:30 [PATCH] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
2020-12-29  9:31 ` Marc Zyngier
2020-12-29 23:16   ` Adam Lackorzynski

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.