Re: drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)'

From: Lokesh Vutla
Date: Thu Sep 03 2020 - 11:11:52 EST


Hi Dan,

On 03/09/20 5:51 pm, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: fc3abb53250a90ba2150eebd182137c136f4d25a
> commit: a5b659bd4bc7518a8e45fda5256c5e5e8d3b7c49 irqchip/ti-sci-intr: Add support for INTR being a parent to INTR
> config: arm64-randconfig-m031-20200902 (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> smatch warnings:
> drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)'
>
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5b659bd4bc7518a8e45fda5256c5e5e8d3b7c49
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout a5b659bd4bc7518a8e45fda5256c5e5e8d3b7c49
> vim +148 drivers/irqchip/irq-ti-sci-intr.c
>
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 134 static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,
> cd844b0715ceda Lokesh Vutla 2019-04-30 135 unsigned int virq, u32 hwirq)
> cd844b0715ceda Lokesh Vutla 2019-04-30 136 {
> cd844b0715ceda Lokesh Vutla 2019-04-30 137 struct ti_sci_intr_irq_domain *intr = domain->host_data;
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 138 struct device_node *parent_node;
> cd844b0715ceda Lokesh Vutla 2019-04-30 139 struct irq_fwspec fwspec;
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 140 u16 out_irq, p_hwirq;
> ^^^ ^^^^^^^
>
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 141 int err = 0;
> cd844b0715ceda Lokesh Vutla 2019-04-30 142
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 143 out_irq = ti_sci_get_free_resource(intr->out_irqs);
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 144 if (out_irq == TI_SCI_RESOURCE_NULL)
> cd844b0715ceda Lokesh Vutla 2019-04-30 145 return -EINVAL;
> cd844b0715ceda Lokesh Vutla 2019-04-30 146
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 147 p_hwirq = ti_sci_intr_xlate_irq(intr, out_irq);
> a5b659bd4bc751 Lokesh Vutla 2020-08-06 @148 if (p_hwirq < 0)
> ^^^^^^^^^^^
> Impossible

This is already fixed by https://patchwork.kernel.org/patch/11737169/

Thanks and regards,
Lokesh