summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-08-13 12:32:47 -0700
committerJakub Kicinski <kuba@kernel.org>2026-08-17 10:35:38 -0700
commit2b49709667de8d6a5fbf4c4b7585aa08e9db5582 (patch)
treee68906998827b9c3aaa9fe1bb80d2f24cf1a87ca /drivers
parent3f33a2d2ea928d6e657dd11e2ac8a3d01785f5e2 (diff)
eth: bnxt: decrease indent in bnxt_init_int_mode()
Handle the IRQ table allocation failure right away instead of wrapping the rest of the function in an if. Purely to make upcoming changes more readable. While refactoring, drop the init of rc which is not necessary. No functional changes. Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Link: https://patch.msgid.link/20260813193248.2578626-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 1e4944f3e606..d3531cd283a5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -11592,7 +11592,7 @@ static int bnxt_get_num_msix(struct bnxt *bp)
static int bnxt_init_int_mode(struct bnxt *bp)
{
- int i, total_vecs, max, rc = 0, min = 1, ulp_msix, tx_cp, tbl_size;
+ int i, total_vecs, max, rc, min = 1, ulp_msix, tx_cp, tbl_size;
total_vecs = bnxt_get_num_msix(bp);
max = bnxt_get_max_func_irqs(bp);
@@ -11617,26 +11617,26 @@ static int bnxt_init_int_mode(struct bnxt *bp)
if (pci_msix_can_alloc_dyn(bp->pdev))
tbl_size = max;
bp->irq_tbl = kzalloc_objs(*bp->irq_tbl, tbl_size);
- if (bp->irq_tbl) {
- for (i = 0; i < total_vecs; i++)
- bp->irq_tbl[i].vector = pci_irq_vector(bp->pdev, i);
-
- bp->total_irqs = total_vecs;
- /* Trim rings based upon num of vectors allocated */
- rc = bnxt_trim_rings(bp, &bp->rx_nr_rings, &bp->tx_nr_rings,
- total_vecs - ulp_msix, min == 1);
- if (rc)
- goto msix_setup_exit;
-
- tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
- bp->cp_nr_rings = (min == 1) ?
- max_t(int, tx_cp, bp->rx_nr_rings) :
- tx_cp + bp->rx_nr_rings;
-
- } else {
+ if (!bp->irq_tbl) {
rc = -ENOMEM;
goto msix_setup_exit;
}
+
+ for (i = 0; i < total_vecs; i++)
+ bp->irq_tbl[i].vector = pci_irq_vector(bp->pdev, i);
+
+ bp->total_irqs = total_vecs;
+ /* Trim rings based upon num of vectors allocated */
+ rc = bnxt_trim_rings(bp, &bp->rx_nr_rings, &bp->tx_nr_rings,
+ total_vecs - ulp_msix, min == 1);
+ if (rc)
+ goto msix_setup_exit;
+
+ tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
+ bp->cp_nr_rings = (min == 1) ?
+ max_t(int, tx_cp, bp->rx_nr_rings) :
+ tx_cp + bp->rx_nr_rings;
+
return 0;
msix_setup_exit: