netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net 3/6] bnxt_en: Always set output parameters in bnxt_get_max_rings().
Date: Mon,  9 Jul 2018 02:24:49 -0400	[thread overview]
Message-ID: <1531117492-21420-4-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1531117492-21420-1-git-send-email-michael.chan@broadcom.com>

The current code returns -ENOMEM and does not bother to set the output
parameters to 0 when no rings are available.  Some callers, such as
bnxt_get_channels() will display garbage ring numbers when that happens.
Fix it by always setting the output parameters.

Fixes: 6e6c5a57fbe1 ("bnxt_en: Modify bnxt_get_max_rings() to support shared or non shared rings.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 5d95d78..5a47607 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8502,11 +8502,11 @@ int bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, bool shared)
 	int rx, tx, cp;
 
 	_bnxt_get_max_rings(bp, &rx, &tx, &cp);
+	*max_rx = rx;
+	*max_tx = tx;
 	if (!rx || !tx || !cp)
 		return -ENOMEM;
 
-	*max_rx = rx;
-	*max_tx = tx;
 	return bnxt_trim_rings(bp, max_rx, max_tx, cp, shared);
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2018-07-09  6:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09  6:24 [PATCH net 0/6] bnxt_en: Bug fixes Michael Chan
2018-07-09  6:24 ` [PATCH net 1/6] bnxt_en: Fix the vlan_tci exact match check Michael Chan
2018-07-09  6:24 ` [PATCH net 2/6] bnxt_en: Fix inconsistent BNXT_FLAG_AGG_RINGS logic Michael Chan
2018-07-09  6:24 ` Michael Chan [this message]
2018-07-09  6:24 ` [PATCH net 4/6] bnxt_en: Support clearing of the IFF_BROADCAST flag Michael Chan
2018-07-09  6:24 ` [PATCH net 5/6] bnxt_en: Do not modify max IRQ count after RDMA driver requests/frees IRQs Michael Chan
2018-07-09  6:24 ` [PATCH net 6/6] bnxt_en: Fix for system hang if request_irq fails Michael Chan
2018-07-09 23:28 ` [PATCH net 0/6] bnxt_en: Bug fixes David Miller

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=1531117492-21420-4-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).