Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bnxt_en: eliminate the compile warning in bnxt_request_irq due to CONFIG_RFS_ACCEL

I received a kernel-test-bot report[1] that shows the
[-Wunused-but-set-variable] warning. Since the previous commit I made, as
the 'Fixes' tag shows, gives users an option to turn on and off the
CONFIG_RFS_ACCEL, the issue then can be discovered and reproduced with
GCC specifically.

Like Simon and Jakub suggested, use fewer #ifdefs which leads to fewer
bugs.

[1]
All warnings (new ones prefixed by >>):

drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_request_irq':
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:10703:9: warning: variable 'j' set but not used [-Wunused-but-set-variable]
10703 | int i, j, rc = 0;
| ^

Fixes: 9b6a30febddf ("net: allow rps/rfs related configs to be switched")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506282102.x1tXt0qz-lkp@intel.com/
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jason Xing and committed by
David S. Miller
b9fd9888 17bbde2e

+4 -6
+4 -6
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 11607 11607 11608 11608 static int bnxt_request_irq(struct bnxt *bp) 11609 11609 { 11610 + struct cpu_rmap *rmap = NULL; 11610 11611 int i, j, rc = 0; 11611 11612 unsigned long flags = 0; 11612 - #ifdef CONFIG_RFS_ACCEL 11613 - struct cpu_rmap *rmap; 11614 - #endif 11615 11613 11616 11614 rc = bnxt_setup_int_mode(bp); 11617 11615 if (rc) { ··· 11630 11632 int map_idx = bnxt_cp_num_to_irq_num(bp, i); 11631 11633 struct bnxt_irq *irq = &bp->irq_tbl[map_idx]; 11632 11634 11633 - #ifdef CONFIG_RFS_ACCEL 11634 - if (rmap && bp->bnapi[i]->rx_ring) { 11635 + if (IS_ENABLED(CONFIG_RFS_ACCEL) && 11636 + rmap && bp->bnapi[i]->rx_ring) { 11635 11637 rc = irq_cpu_rmap_add(rmap, irq->vector); 11636 11638 if (rc) 11637 11639 netdev_warn(bp->dev, "failed adding irq rmap for ring %d\n", 11638 11640 j); 11639 11641 j++; 11640 11642 } 11641 - #endif 11643 + 11642 11644 rc = request_irq(irq->vector, irq->handler, flags, irq->name, 11643 11645 bp->bnapi[i]); 11644 11646 if (rc)