[l1k:smsc95xx_5.17 95/888] drivers/irqchip/irq-bcm2835.c:204:22: warning: variable 'last_irq' set but not used

From: kernel test robot
Date: Fri Apr 08 2022 - 19:04:57 EST


tree: https://github.com/l1k/linux smsc95xx_5.17
head: 240f56c27361c195cd502d95aba51c6b8e5b808c
commit: d721ee482d0edde5df2ddd15556b1e2754bdc5c0 [95/888] irqchip: irq-bcm2835: Calc. FIQ_START at boot-time
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20220409/202204090628.LCLaLqKj-lkp@xxxxxxxxx/config)
compiler: aarch64-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/l1k/linux/commit/d721ee482d0edde5df2ddd15556b1e2754bdc5c0
git remote add l1k https://github.com/l1k/linux
git fetch --no-tags l1k smsc95xx_5.17
git checkout d721ee482d0edde5df2ddd15556b1e2754bdc5c0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash

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-bcm2835.c: In function 'armctrl_of_init':
>> drivers/irqchip/irq-bcm2835.c:204:22: warning: variable 'last_irq' set but not used [-Wunused-but-set-variable]
204 | int irq = 0, last_irq, b, i;
| ^~~~~~~~


vim +/last_irq +204 drivers/irqchip/irq-bcm2835.c

198
199 static int __init armctrl_of_init(struct device_node *node,
200 struct device_node *parent,
201 bool is_2836)
202 {
203 void __iomem *base;
> 204 int irq = 0, last_irq, b, i;
205 u32 reg;
206
207 base = of_iomap(node, 0);
208 if (!base)
209 panic("%pOF: unable to map IC registers\n", node);
210
211 intc.base = base;
212 intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2,
213 &armctrl_ops, NULL);
214 if (!intc.domain)
215 panic("%pOF: unable to create IRQ domain\n", node);
216
217 for (b = 0; b < NR_BANKS; b++) {
218 intc.pending[b] = base + reg_pending[b];
219 intc.enable[b] = base + reg_enable[b];
220 intc.disable[b] = base + reg_disable[b];
221
222 for (i = 0; i < bank_irqs[b]; i++) {
223 irq = irq_create_mapping(intc.domain, MAKE_HWIRQ(b, i));
224 BUG_ON(irq <= 0);
225 irq_set_chip_and_handler(irq, &armctrl_chip,
226 handle_level_irq);
227 irq_set_probe(irq);
228 }
229
230 reg = readl_relaxed(intc.enable[b]);
231 if (reg) {
232 writel_relaxed(reg, intc.disable[b]);
233 pr_err(FW_BUG "Bootloader left irq enabled: "
234 "bank %d irq %*pbl\n", b, IRQS_PER_BANK, &reg);
235 }
236 }
237
238 reg = readl_relaxed(base + REG_FIQ_CONTROL);
239 if (reg & FIQ_CONTROL_ENABLE) {
240 writel_relaxed(0, base + REG_FIQ_CONTROL);
241 pr_err(FW_BUG "Bootloader left fiq enabled\n");
242 }
243
244 last_irq = irq;
245
246 if (is_2836) {
247 int parent_irq = irq_of_parse_and_map(node, 0);
248
249 if (!parent_irq) {
250 panic("%pOF: unable to get parent interrupt.\n",
251 node);
252 }
253 irq_set_chained_handler(parent_irq, bcm2836_chained_handle_irq);
254 } else {
255 set_handle_irq(bcm2835_handle_irq);
256 }
257
258 if (is_2836) {
259 extern void __iomem * __attribute__((weak)) arm_local_intc;
260 intc.local_base = arm_local_intc;
261 if (!intc.local_base)
262 pr_err("Failed to get local intc base. FIQ is disabled for cpus > 1\n");
263 }
264
265 /* Make a duplicate irq range which is used to enable FIQ */
266 for (b = 0; b < NR_BANKS; b++) {
267 for (i = 0; i < bank_irqs[b]; i++) {
268 irq = irq_create_mapping(intc.domain,
269 MAKE_HWIRQ(b, i) + NUMBER_IRQS);
270 BUG_ON(irq <= 0);
271 irq_set_chip(irq, &armctrl_chip);
272 irq_set_probe(irq);
273 }
274 }
275 #ifndef CONFIG_ARM64
276 init_FIQ(irq - last_irq);
277 #endif
278
279 return 0;
280 }
281

--
0-DAY CI Kernel Test Service
https://01.org/lkp