[Adding the person who introduced the code]

On Sun, 24 Feb 2013, Russell King - ARM Linux wrote:

> On Sun, Feb 24, 2013 at 12:45:11PM +0100, Julia Lawall wrote:
> > The function s3c24xx_irq_map in arch/arm/mach-s3c24xx/irq.c contains the
> > code:
> >
> >                 parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
> >             if (!irq_data) {
> >                         pr_err("irq-s3c24xx: no irq data found for hwirq 
> > %lu\n",
> >                                hw);
> >                         goto err;
> >             }
> >
> > At this point irq_data has already been tested, so the null test on
> > irq_data does not look correct.  But I wonder if parent_irq_data could
> > ever be null here?
>
> That would be really obscure - because that would require parent_intc to
> be a "negative" pointer (to counter-act the indexing by
> irq_data->parent_irq).  So it looks to me like the above is redundant.

Even at its original definition irq_data seems unlikely to be NULL:

        struct s3c_irq_intc *intc = h->host_data;
        struct s3c_irq_data *irq_data = &intc->irqs[hw];
        ...
        if (!irq_data) {
                pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw);
                return -EINVAL;
        }

That is, it could be an invalid value, but whether it actually hits 0
would seem to depend on the value hw?

Heiko, is NULL really a possibility?

thanks,
julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to