* [PATCH] irqchip/gic: add WARN_ON() to facilitate backtracking
@ 2020-12-29 7:15 Yejune Deng
2020-12-29 9:27 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: Yejune Deng @ 2020-12-29 7:15 UTC (permalink / raw)
To: tglx, maz; +Cc: linux-kernel, yejune.deng
There is two function gic_of_init() and gic_of_init_child() called
gic_of_setup(),so add WARN_ON() to facilitate backtracking.
Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
drivers/irqchip/irq-gic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index b1d9c22..7c11705 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -1380,7 +1380,7 @@ static bool gic_check_eoimode(struct device_node *node, void __iomem **base)
static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node)
{
- if (!gic || !node)
+ if (WARN_ON(!gic || !node))
return -EINVAL;
gic->raw_dist_base = of_iomap(node, 0);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] irqchip/gic: add WARN_ON() to facilitate backtracking
2020-12-29 7:15 [PATCH] irqchip/gic: add WARN_ON() to facilitate backtracking Yejune Deng
@ 2020-12-29 9:27 ` Marc Zyngier
2020-12-30 2:16 ` Yejune Deng
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2020-12-29 9:27 UTC (permalink / raw)
To: Yejune Deng; +Cc: tglx, linux-kernel
Yejune,
On 2020-12-29 07:15, Yejune Deng wrote:
> There is two function gic_of_init() and gic_of_init_child() called
> gic_of_setup(),so add WARN_ON() to facilitate backtracking.
>
> Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> ---
> drivers/irqchip/irq-gic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index b1d9c22..7c11705 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -1380,7 +1380,7 @@ static bool gic_check_eoimode(struct device_node
> *node, void __iomem **base)
>
> static int gic_of_setup(struct gic_chip_data *gic, struct device_node
> *node)
> {
> - if (!gic || !node)
> + if (WARN_ON(!gic || !node))
> return -EINVAL;
>
> gic->raw_dist_base = of_iomap(node, 0);
I don't immediately see what you gain with this. If you end-up here
with NULL pointers, that either because:
- you have failed to allocate the GIC private data structure:
but as it turns out, these allocations either cannot fail (gic_data[]
is static), or the dynamic allocation in gic_of_init_child() is
already
checked.
- node is NULL: both paths already check for a NULL node, so that cannot
fail either.
My conclusion is that these checks can never trigger, and we should be
able to *remove* them altogether.
Am I missing something?
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] irqchip/gic: add WARN_ON() to facilitate backtracking
2020-12-29 9:27 ` Marc Zyngier
@ 2020-12-30 2:16 ` Yejune Deng
0 siblings, 0 replies; 3+ messages in thread
From: Yejune Deng @ 2020-12-30 2:16 UTC (permalink / raw)
To: Marc Zyngier; +Cc: tglx, Linux Kernel Mailing List
OK,I will adopt it and resubmit.
On Tue, Dec 29, 2020 at 5:27 PM Marc Zyngier <maz@kernel.org> wrote:
>
> Yejune,
>
> On 2020-12-29 07:15, Yejune Deng wrote:
> > There is two function gic_of_init() and gic_of_init_child() called
> > gic_of_setup(),so add WARN_ON() to facilitate backtracking.
> >
> > Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> > ---
> > drivers/irqchip/irq-gic.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> > index b1d9c22..7c11705 100644
> > --- a/drivers/irqchip/irq-gic.c
> > +++ b/drivers/irqchip/irq-gic.c
> > @@ -1380,7 +1380,7 @@ static bool gic_check_eoimode(struct device_node
> > *node, void __iomem **base)
> >
> > static int gic_of_setup(struct gic_chip_data *gic, struct device_node
> > *node)
> > {
> > - if (!gic || !node)
> > + if (WARN_ON(!gic || !node))
> > return -EINVAL;
> >
> > gic->raw_dist_base = of_iomap(node, 0);
>
> I don't immediately see what you gain with this. If you end-up here
> with NULL pointers, that either because:
>
> - you have failed to allocate the GIC private data structure:
> but as it turns out, these allocations either cannot fail (gic_data[]
> is static), or the dynamic allocation in gic_of_init_child() is
> already
> checked.
>
> - node is NULL: both paths already check for a NULL node, so that cannot
> fail either.
>
> My conclusion is that these checks can never trigger, and we should be
> able to *remove* them altogether.
>
> Am I missing something?
>
> M.
> --
> Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-30 2:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 7:15 [PATCH] irqchip/gic: add WARN_ON() to facilitate backtracking Yejune Deng
2020-12-29 9:27 ` Marc Zyngier
2020-12-30 2:16 ` Yejune Deng
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.