drivers/irqchip/irq-loongson-htpic.c:62:12: warning: variable 'val' set but not used

From: kernel test robot
Date: Wed Nov 11 2020 - 04:42:58 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eccc876724927ff3b9ff91f36f7b6b159e948f0c
commit: a93f1d903fa34fc2c5d9fa450bdb6c28d6fdfe00 irqchip: Add driver for Loongson-3 HyperTransport PIC controller
date: 8 months ago
config: mips-randconfig-r005-20201111 (attached as .config)
compiler: mips64el-linux-gcc (GCC) 9.3.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a93f1d903fa34fc2c5d9fa450bdb6c28d6fdfe00
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a93f1d903fa34fc2c5d9fa450bdb6c28d6fdfe00
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips

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

All warnings (new ones prefixed by >>):

drivers/irqchip/irq-loongson-htpic.c: In function 'htpic_reg_init':
>> drivers/irqchip/irq-loongson-htpic.c:62:12: warning: variable 'val' set but not used [-Wunused-but-set-variable]
62 | uint32_t val;
| ^~~
drivers/irqchip/irq-loongson-htpic.c: At top level:
>> drivers/irqchip/irq-loongson-htpic.c:84:12: warning: no previous prototype for 'htpic_of_init' [-Wmissing-prototypes]
84 | int __init htpic_of_init(struct device_node *node, struct device_node *parent)
| ^~~~~~~~~~~~~

vim +/val +62 drivers/irqchip/irq-loongson-htpic.c

56
57 static void htpic_reg_init(void)
58 {
59 int i;
60
61 for (i = 0; i < HTINT_NUM_VECTORS; i++) {
> 62 uint32_t val;
63
64 /* Disable all HT Vectors */
65 writel(0x0, htpic->base + HTINT_EN_OFF + i * 0x4);
66 val = readl(htpic->base + i * 0x4);
67 /* Ack all possible pending IRQs */
68 writel(GENMASK(31, 0), htpic->base + i * 0x4);
69 }
70
71 /* Enable 16 vectors for PIC */
72 writel(0xffff, htpic->base + HTINT_EN_OFF);
73 }
74
75 static void htpic_resume(void)
76 {
77 htpic_reg_init();
78 }
79
80 struct syscore_ops htpic_syscore_ops = {
81 .resume = htpic_resume,
82 };
83
> 84 int __init htpic_of_init(struct device_node *node, struct device_node *parent)
85 {
86 unsigned int parent_irq[4];
87 int i, err;
88 int num_parents = 0;
89
90 if (htpic) {
91 pr_err("loongson-htpic: Only one HTPIC is allowed in the system\n");
92 return -ENODEV;
93 }
94
95 htpic = kzalloc(sizeof(*htpic), GFP_KERNEL);
96 if (!htpic) {
97 err = -ENOMEM;
98 goto out_free;
99 }
100
101 htpic->base = of_iomap(node, 0);
102 if (!htpic->base) {
103 err = -ENODEV;
104 goto out_free;
105 }
106
107 htpic->domain = __init_i8259_irqs(node);
108 if (!htpic->domain) {
109 pr_err("loongson-htpic: Failed to initialize i8259 IRQs\n");
110 err = -ENOMEM;
111 goto out_iounmap;
112 }
113
114 /* Interrupt may come from any of the 4 interrupt line */
115 for (i = 0; i < HTPIC_MAX_PARENT_IRQ; i++) {
116 parent_irq[i] = irq_of_parse_and_map(node, i);
117 if (parent_irq[i] <= 0)
118 break;
119
120 num_parents++;
121 }
122
123 if (!num_parents) {
124 pr_err("loongson-htpic: Failed to get parent irqs\n");
125 err = -ENODEV;
126 goto out_remove_domain;
127 }
128
129 htpic_reg_init();
130
131 for (i = 0; i < num_parents; i++) {
132 irq_set_chained_handler_and_data(parent_irq[i],
133 htpic_irq_dispatch, htpic);
134 }
135
136 register_syscore_ops(&htpic_syscore_ops);
137
138 return 0;
139
140 out_remove_domain:
141 irq_domain_remove(htpic->domain);
142 out_iounmap:
143 iounmap(htpic->base);
144 out_free:
145 kfree(htpic);
146 return err;
147 }
148

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

Attachment: .config.gz
Description: application/gzip