public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)'
@ 2020-09-03 12:21 Dan Carpenter
  2020-09-03 12:26 ` Lokesh Vutla
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-09-03 12:21 UTC (permalink / raw)
  To: kbuild, Lokesh Vutla
  Cc: lkp, Dan Carpenter, kbuild-all, linux-kernel, Marc Zyngier

[-- Attachment #1: Type: text/plain, Size: 4784 bytes --]

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

a5b659bd4bc751 Lokesh Vutla 2020-08-06  149  		goto err_irqs;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  150  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  151  	parent_node = of_irq_find_parent(dev_of_node(intr->dev));
a5b659bd4bc751 Lokesh Vutla 2020-08-06  152  	fwspec.fwnode = of_node_to_fwnode(parent_node);
a5b659bd4bc751 Lokesh Vutla 2020-08-06  153  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  154  	if (of_device_is_compatible(parent_node, "arm,gic-v3")) {
a5b659bd4bc751 Lokesh Vutla 2020-08-06  155  		/* Parent is GIC */
cd844b0715ceda Lokesh Vutla 2019-04-30  156  		fwspec.param_count = 3;
cd844b0715ceda Lokesh Vutla 2019-04-30  157  		fwspec.param[0] = 0;	/* SPI */
a5b659bd4bc751 Lokesh Vutla 2020-08-06  158  		fwspec.param[1] = p_hwirq - 32; /* SPI offset */
cd844b0715ceda Lokesh Vutla 2019-04-30  159  		fwspec.param[2] = intr->type;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  160  	} else {
a5b659bd4bc751 Lokesh Vutla 2020-08-06  161  		/* Parent is Interrupt Router */
a5b659bd4bc751 Lokesh Vutla 2020-08-06  162  		fwspec.param_count = 1;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  163  		fwspec.param[0] = p_hwirq;
a5b659bd4bc751 Lokesh Vutla 2020-08-06  164  	}
cd844b0715ceda Lokesh Vutla 2019-04-30  165  
cd844b0715ceda Lokesh Vutla 2019-04-30  166  	err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
cd844b0715ceda Lokesh Vutla 2019-04-30  167  	if (err)
cd844b0715ceda Lokesh Vutla 2019-04-30  168  		goto err_irqs;
cd844b0715ceda Lokesh Vutla 2019-04-30  169  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  170  	err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci,
a5b659bd4bc751 Lokesh Vutla 2020-08-06  171  						intr->ti_sci_id, hwirq,
a5b659bd4bc751 Lokesh Vutla 2020-08-06  172  						intr->ti_sci_id, out_irq);
cd844b0715ceda Lokesh Vutla 2019-04-30  173  	if (err)
cd844b0715ceda Lokesh Vutla 2019-04-30  174  		goto err_msg;
cd844b0715ceda Lokesh Vutla 2019-04-30  175  
a5b659bd4bc751 Lokesh Vutla 2020-08-06  176  	return p_hwirq;
cd844b0715ceda Lokesh Vutla 2019-04-30  177  
cd844b0715ceda Lokesh Vutla 2019-04-30  178  err_msg:
cd844b0715ceda Lokesh Vutla 2019-04-30  179  	irq_domain_free_irqs_parent(domain, virq, 1);
cd844b0715ceda Lokesh Vutla 2019-04-30  180  err_irqs:
a5b659bd4bc751 Lokesh Vutla 2020-08-06  181  	ti_sci_release_resource(intr->out_irqs, out_irq);
cd844b0715ceda Lokesh Vutla 2019-04-30  182  	return err;
cd844b0715ceda Lokesh Vutla 2019-04-30  183  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37827 bytes --]

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

* Re: drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)'
  2020-09-03 12:21 drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)' Dan Carpenter
@ 2020-09-03 12:26 ` Lokesh Vutla
  0 siblings, 0 replies; 2+ messages in thread
From: Lokesh Vutla @ 2020-09-03 12:26 UTC (permalink / raw)
  To: Dan Carpenter, kbuild
  Cc: lkp, Dan Carpenter, kbuild-all, linux-kernel, Marc Zyngier

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@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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


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

end of thread, other threads:[~2020-09-03 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-03 12:21 drivers/irqchip/irq-ti-sci-intr.c:148 ti_sci_intr_alloc_parent_irq() warn: impossible condition '(p_hwirq < 0) => (0-u16max < 0)' Dan Carpenter
2020-09-03 12:26 ` Lokesh Vutla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox