From: Rasesh Mody <rmody@brocade.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>,
<adapter_linux_open_src_team@Brocade.COM>,
Rasesh Mody <rmody@Brocade.COM>
Subject: [net-next 09/12] bna: Handle the TX Setup Failures
Date: Tue, 10 Dec 2013 23:00:48 -0800 [thread overview]
Message-ID: <1386745251-13710-10-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1386745251-13710-1-git-send-email-rmody@brocade.com>
Change details:
- When bnad_setup_tx() returns NULL, the error is NOT returned to the caller.
The caller will incorrectly assume success. So Return ENOMEM when bna_tx_create()
fails.
- If bnad_tx_msix_register() fails, call bna_tx_destroy() to free tx & to NULL
the bnad reference to tcb.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
drivers/net/ethernet/brocade/bna/bnad.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 27bdd6c..2db645a 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -1987,8 +1987,10 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id)
tx = bna_tx_create(&bnad->bna, bnad, tx_config, &tx_cbfn, res_info,
tx_info);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
- if (!tx)
+ if (!tx) {
+ err = -ENOMEM;
goto err_return;
+ }
tx_info->tx = tx;
INIT_DELAYED_WORK(&tx_info->tx_cleanup_work,
@@ -1999,7 +2001,7 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id)
err = bnad_tx_msix_register(bnad, tx_info,
tx_id, bnad->num_txq_per_tx);
if (err)
- goto err_return;
+ goto cleanup_tx;
}
spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -2008,6 +2010,12 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id)
return 0;
+cleanup_tx:
+ spin_lock_irqsave(&bnad->bna_lock, flags);
+ bna_tx_destroy(tx_info->tx);
+ spin_unlock_irqrestore(&bnad->bna_lock, flags);
+ tx_info->tx = NULL;
+ tx_info->tx_id = 0;
err_return:
bnad_tx_res_free(bnad, res_info);
return err;
--
1.8.2.3
next prev parent reply other threads:[~2013-12-11 7:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 7:00 [net-next 00/12] bna: Update the Driver to v3.2.23.0 Rasesh Mody
2013-12-11 7:00 ` [net-next 01/12] bna: Add software timestamping support Rasesh Mody
2013-12-11 7:00 ` [net-next 02/12] bna: Set Get IOC fw State Rasesh Mody
2013-12-11 7:00 ` [net-next 03/12] bna: Fix Filter Add Del Rasesh Mody
2013-12-11 7:00 ` [net-next 04/12] bna: RX Filter Enhancements Rasesh Mody
2013-12-11 7:00 ` [net-next 05/12] bna: Enable Multi Buffer RX Rasesh Mody
2013-12-11 17:27 ` David Miller
2013-12-12 16:04 ` Rasesh Mody
2013-12-11 7:00 ` [net-next 06/12] bna: RX Processing and Config Changes Rasesh Mody
2013-12-11 7:00 ` [net-next 07/12] bna: CQ Read Fix Rasesh Mody
2013-12-11 7:00 ` [net-next 08/12] bna: Add NULL Check Before Dereferencing TCB Rasesh Mody
2013-12-11 7:00 ` Rasesh Mody [this message]
2013-12-11 7:00 ` [net-next 10/12] bna: Embed SKB Length in TX Vector Rasesh Mody
2013-12-11 7:00 ` [net-next 11/12] bna: Firmware Patch Simplification Rasesh Mody
2013-12-11 7:00 ` [net-next 12/12] bna: Update the Driver Version to 3.2.23.0 Rasesh Mody
-- strict thread matches above, loose matches on Subject: below --
2013-12-13 1:54 [net-next 00/12] bna: Update the Driver to v3.2.23.0 Rasesh Mody
2013-12-13 1:54 ` [net-next 09/12] bna: Handle the TX Setup Failures Rasesh Mody
2013-12-18 1:07 [net-next 00/12] bna: Update the Driver to v3.2.23.0 Rasesh Mody
2013-12-18 1:07 ` [net-next 09/12] bna: Handle the TX Setup Failures Rasesh Mody
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=1386745251-13710-10-git-send-email-rmody@brocade.com \
--to=rmody@brocade.com \
--cc=adapter_linux_open_src_team@Brocade.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).