[meghadey-crypto:d_msix 1/1] kernel/irq/msi.c:572:16: warning: variable 'ret' set but not used

From: kernel test robot
Date: Sun Aug 29 2021 - 17:52:17 EST


tree: https://github.com/meghadey/crypto d_msix
head: 37b5937a105abc8efe975c67fe4444e47da17c60
commit: 37b5937a105abc8efe975c67fe4444e47da17c60 [1/1] PCI/MSI: Dynamic allocation of MSI-X vectors
config: sparc64-randconfig-r002-20210829 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/meghadey/crypto/commit/37b5937a105abc8efe975c67fe4444e47da17c60
git remote add meghadey-crypto https://github.com/meghadey/crypto
git fetch --no-tags meghadey-crypto d_msix
git checkout 37b5937a105abc8efe975c67fe4444e47da17c60
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=sparc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from <command-line>:
kernel/irq/msi.c: In function '__msi_domain_alloc_irqs':
include/linux/compiler_types.h:328:68: error: unterminated argument list invoking macro "if"
328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~
include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
| ^~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
49 | compiletime_assert_rwonce_type(x); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/percpu.h:119:18: note: in expansion of macro 'READ_ONCE'
119 | ___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \
| ^~~~~~~~~
include/asm-generic/percpu.h:138:25: note: in expansion of macro '__this_cpu_generic_read_nopreempt'
138 | __ret = __this_cpu_generic_read_nopreempt(pcp); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/percpu.h:329:41: note: in expansion of macro 'this_cpu_generic_read'
329 | #define this_cpu_read_8(pcp) this_cpu_generic_read(pcp)
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:324:30: note: in expansion of macro 'this_cpu_read_8'
324 | case 8: pscr_ret__ = stem##8(variable); break; \
| ^~~~
include/linux/percpu-defs.h:507:41: note: in expansion of macro '__pcpu_size_call_return'
507 | #define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/interrupt.h:561:16: note: in expansion of macro 'this_cpu_read'
561 | return this_cpu_read(ksoftirqd);
| ^~~~~~~~~~~~~
kernel/irq/msi.c:730: error: expected '(' at end of input
kernel/irq/msi.c:576:9: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
576 | if (ret
| ^~
kernel/irq/msi.c:576:9: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory
kernel/irq/msi.c:576:9: error: expected declaration or statement at end of input
kernel/irq/msi.c:573:14: warning: unused variable 'can_reserve' [-Wunused-variable]
573 | bool can_reserve;
| ^~~~~~~~~~~
kernel/irq/msi.c:572:21: warning: unused variable 'virq' [-Wunused-variable]
572 | int i, ret, virq;
| ^~~~
>> kernel/irq/msi.c:572:16: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
572 | int i, ret, virq;
| ^~~
kernel/irq/msi.c:572:13: warning: unused variable 'i' [-Wunused-variable]
572 | int i, ret, virq;
| ^
kernel/irq/msi.c:570:26: warning: unused variable 'desc' [-Wunused-variable]
570 | struct msi_desc *desc;
| ^~~~
kernel/irq/msi.c:569:26: warning: unused variable 'irq_data' [-Wunused-variable]
569 | struct irq_data *irq_data;
| ^~~~~~~~
kernel/irq/msi.c:568:32: warning: unused variable 'ops' [-Wunused-variable]
568 | struct msi_domain_ops *ops = info->ops;
| ^~~
kernel/irq/msi.c:730: error: control reaches end of non-void function [-Werror=return-type]
At top level:
kernel/irq/msi.c:536:13: warning: 'msi_check_reservation_mode' defined but not used [-Wunused-function]
536 | static bool msi_check_reservation_mode(struct irq_domain *domain,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/ret +572 kernel/irq/msi.c

da5dd9e854d2ed Thomas Gleixner 2017-12-29 563
43e9e705dd57c4 Thomas Gleixner 2020-08-26 564 int __msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
d9109698be6e74 Jiang Liu 2014-11-15 565 int nvec)
d9109698be6e74 Jiang Liu 2014-11-15 566 {
d9109698be6e74 Jiang Liu 2014-11-15 567 struct msi_domain_info *info = domain->host_data;
d9109698be6e74 Jiang Liu 2014-11-15 568 struct msi_domain_ops *ops = info->ops;
da5dd9e854d2ed Thomas Gleixner 2017-12-29 569 struct irq_data *irq_data;
d9109698be6e74 Jiang Liu 2014-11-15 570 struct msi_desc *desc;
06fde695ee7642 Zenghui Yu 2020-12-18 571 msi_alloc_info_t arg = { };
b6140914fd079e Thomas Gleixner 2016-07-04 @572 int i, ret, virq;
da5dd9e854d2ed Thomas Gleixner 2017-12-29 573 bool can_reserve;
d9109698be6e74 Jiang Liu 2014-11-15 574
b2eba39bcab9d6 Marc Zyngier 2015-11-23 575 ret = msi_domain_prepare_irqs(domain, dev, nvec, &arg);
37b5937a105abc Megha Dey 2021-08-26 @576 if (ret
d9109698be6e74 Jiang Liu 2014-11-15 577 return ret;
d9109698be6e74 Jiang Liu 2014-11-15 578
37b5937a105abc Megha Dey 2021-08-26 579 for_each_msi_entry_from(desc, dev) {
d9109698be6e74 Jiang Liu 2014-11-15 580 ops->set_desc(&arg, desc);
d9109698be6e74 Jiang Liu 2014-11-15 581
b6140914fd079e Thomas Gleixner 2016-07-04 582 virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used,
06ee6d571f0e35 Thomas Gleixner 2016-07-04 583 dev_to_node(dev), &arg, false,
0972fa57f53525 Thomas Gleixner 2016-07-04 584 desc->affinity);
d9109698be6e74 Jiang Liu 2014-11-15 585 if (virq < 0) {
d9109698be6e74 Jiang Liu 2014-11-15 586 ret = -ENOSPC;
d9109698be6e74 Jiang Liu 2014-11-15 587 if (ops->handle_error)
d9109698be6e74 Jiang Liu 2014-11-15 588 ret = ops->handle_error(domain, desc, ret);
d9109698be6e74 Jiang Liu 2014-11-15 589 if (ops->msi_finish)
d9109698be6e74 Jiang Liu 2014-11-15 590 ops->msi_finish(&arg, ret);
d9109698be6e74 Jiang Liu 2014-11-15 591 return ret;
d9109698be6e74 Jiang Liu 2014-11-15 592 }
d9109698be6e74 Jiang Liu 2014-11-15 593
07557ccb8c83f3 Thomas Gleixner 2017-09-13 594 for (i = 0; i < desc->nvec_used; i++) {
d9109698be6e74 Jiang Liu 2014-11-15 595 irq_set_msi_desc_off(virq, i, desc);
07557ccb8c83f3 Thomas Gleixner 2017-09-13 596 irq_debugfs_copy_devname(virq + i, dev);
07557ccb8c83f3 Thomas Gleixner 2017-09-13 597 }
d9109698be6e74 Jiang Liu 2014-11-15 598 }
d9109698be6e74 Jiang Liu 2014-11-15 599
d9109698be6e74 Jiang Liu 2014-11-15 600 if (ops->msi_finish)
d9109698be6e74 Jiang Liu 2014-11-15 601 ops->msi_finish(&arg, 0);
d9109698be6e74 Jiang Liu 2014-11-15 602
bc976233a872c0 Thomas Gleixner 2017-12-29 603 can_reserve = msi_check_reservation_mode(domain, info, dev);
da5dd9e854d2ed Thomas Gleixner 2017-12-29 604
f3b0946d629c8b Marc Zyngier 2016-07-13 605 /*
f3b0946d629c8b Marc Zyngier 2016-07-13 606 * This flag is set by the PCI layer as we need to activate
f3b0946d629c8b Marc Zyngier 2016-07-13 607 * the MSI entries before the PCI layer enables MSI in the
f3b0946d629c8b Marc Zyngier 2016-07-13 608 * card. Otherwise the card latches a random msi message.
f3b0946d629c8b Marc Zyngier 2016-07-13 609 */
da5dd9e854d2ed Thomas Gleixner 2017-12-29 610 if (!(info->flags & MSI_FLAG_ACTIVATE_EARLY))
4c457e8cb75eda Marc Zyngier 2021-01-23 611 goto skip_activate;
f3b0946d629c8b Marc Zyngier 2016-07-13 612
37b5937a105abc Megha Dey 2021-08-26 613 for_each_msi_vector_from(desc, i, dev) {
4c457e8cb75eda Marc Zyngier 2021-01-23 614 if (desc->irq == i) {
4c457e8cb75eda Marc Zyngier 2021-01-23 615 virq = desc->irq;
4c457e8cb75eda Marc Zyngier 2021-01-23 616 dev_dbg(dev, "irq [%d-%d] for MSI\n",
4c457e8cb75eda Marc Zyngier 2021-01-23 617 virq, virq + desc->nvec_used - 1);
4c457e8cb75eda Marc Zyngier 2021-01-23 618 }
4c457e8cb75eda Marc Zyngier 2021-01-23 619 irq_data = irq_domain_get_irq_data(domain, i);
6f1a4891a5928a Thomas Gleixner 2020-01-31 620 if (!can_reserve) {
bc976233a872c0 Thomas Gleixner 2017-12-29 621 irqd_clr_can_reserve(irq_data);
6f1a4891a5928a Thomas Gleixner 2020-01-31 622 if (domain->flags & IRQ_DOMAIN_MSI_NOMASK_QUIRK)
6f1a4891a5928a Thomas Gleixner 2020-01-31 623 irqd_set_msi_nomask_quirk(irq_data);
6f1a4891a5928a Thomas Gleixner 2020-01-31 624 }
bc976233a872c0 Thomas Gleixner 2017-12-29 625 ret = irq_domain_activate_irq(irq_data, can_reserve);
bb9b428a5c832d Thomas Gleixner 2017-09-13 626 if (ret)
bb9b428a5c832d Thomas Gleixner 2017-09-13 627 goto cleanup;
da5dd9e854d2ed Thomas Gleixner 2017-12-29 628 }
da5dd9e854d2ed Thomas Gleixner 2017-12-29 629
4c457e8cb75eda Marc Zyngier 2021-01-23 630 skip_activate:
da5dd9e854d2ed Thomas Gleixner 2017-12-29 631 /*
da5dd9e854d2ed Thomas Gleixner 2017-12-29 632 * If these interrupts use reservation mode, clear the activated bit
da5dd9e854d2ed Thomas Gleixner 2017-12-29 633 * so request_irq() will assign the final vector.
da5dd9e854d2ed Thomas Gleixner 2017-12-29 634 */
da5dd9e854d2ed Thomas Gleixner 2017-12-29 635 if (can_reserve) {
37b5937a105abc Megha Dey 2021-08-26 636 for_each_msi_vector_from(desc, i, dev) {
4c457e8cb75eda Marc Zyngier 2021-01-23 637 irq_data = irq_domain_get_irq_data(domain, i);
22d0b12f3560d3 Thomas Gleixner 2017-09-13 638 irqd_clr_activated(irq_data);
f3b0946d629c8b Marc Zyngier 2016-07-13 639 }
d9109698be6e74 Jiang Liu 2014-11-15 640 }
d9109698be6e74 Jiang Liu 2014-11-15 641 return 0;
bb9b428a5c832d Thomas Gleixner 2017-09-13 642
bb9b428a5c832d Thomas Gleixner 2017-09-13 643 cleanup:
bb9b428a5c832d Thomas Gleixner 2017-09-13 644 msi_domain_free_irqs(domain, dev);
bb9b428a5c832d Thomas Gleixner 2017-09-13 645 return ret;
d9109698be6e74 Jiang Liu 2014-11-15 646 }
d9109698be6e74 Jiang Liu 2014-11-15 647

:::::: The code at line 572 was first introduced by commit
:::::: b6140914fd079e43ea75a53429b47128584f033a genirq/msi: Remove unused MSI_FLAG_IDENTITY_MAP

:::::: TO: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
:::::: CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip