All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, michael.chan@broadcom.com,
	pavan.chebbi@broadcom.com, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 1/2] eth: bnxt: decrease indent in bnxt_init_int_mode()
Date: Thu, 13 Aug 2026 12:32:47 -0700	[thread overview]
Message-ID: <20260813193248.2578626-2-kuba@kernel.org> (raw)
In-Reply-To: <20260813193248.2578626-1-kuba@kernel.org>

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.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 36 +++++++++++------------
 1 file 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:
-- 
2.55.0


  reply	other threads:[~2026-08-13 19:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 19:32 [PATCH net-next 0/2] eth: bnxt: preserve IRQ affinity across IRQ reallocation Jakub Kicinski
2026-08-13 19:32 ` Jakub Kicinski [this message]
2026-08-13 19:32 ` [PATCH net-next 2/2] " Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260813193248.2578626-2-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavan.chebbi@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.