]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: lpfc: Break out of IRQ affinity assignment when mask reaches nr_cpu_ids
authorJustin Tee <justin.tee@broadcom.com>
Tue, 31 Mar 2026 20:59:19 +0000 (13:59 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 3 Apr 2026 01:34:01 +0000 (21:34 -0400)
The purpose of the lpfc_next_online_cpu() call is to save the CPU index for
the next iteration of the for (index = 0; index < vectors; index++) loop.
Because we’ve reached the last iteration of the loop, cpumask_next(cpu,
aff_mask) returns nr_cpu_ids.  Thus, if we already know we've reached the
last iteration of the IRQ affinity assignment loop, then we can just break
and exit.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://patch.msgid.link/20260331205928.119833-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c

index 704c59cc8892211ef099fb055245c2da8c073831..764feaef8a676e19da203619b2b2dd60ef57ca5f 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
  * Copyright (C) 2017-2026 Broadcom. All Rights Reserved. The term *
- * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.broadcom.com                                                *
@@ -13041,6 +13041,10 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
                        /* Iterate to next offline or online cpu in aff_mask */
                        cpu = cpumask_next(cpu, aff_mask);
 
+                       /* Reached the end of the aff_mask */
+                       if (cpu >= nr_cpu_ids)
+                               break;
+
                        /* Find next online cpu in aff_mask to set affinity */
                        cpu_select = lpfc_next_online_cpu(aff_mask, cpu);
                } else if (vectors == 1) {