netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sathya Perla <sathya.perla@emulex.com>
To: <netdev@vger.kernel.org>
Subject: [net-next PATCH 3/5] be2net: reset queue address after freeing
Date: Fri, 24 Feb 2012 10:20:15 +0530	[thread overview]
Message-ID: <1330059017-5976-4-git-send-email-sathya.perla@emulex.com> (raw)
In-Reply-To: <1330059017-5976-1-git-send-email-sathya.perla@emulex.com>

This will prevent double free in some cases where be_clear() is called
for cleanup when be_setup() fails half-way.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 36ad9a7..e382278 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -127,9 +127,11 @@ static inline bool be_is_mc(struct be_adapter *adapter) {
 static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q)
 {
 	struct be_dma_mem *mem = &q->dma_mem;
-	if (mem->va)
+	if (mem->va) {
 		dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
 				  mem->dma);
+		mem->va = NULL;
+	}
 }
 
 static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
@@ -1660,7 +1662,7 @@ static int be_evt_queues_create(struct be_adapter *adapter)
 		if (rc)
 			return rc;
 	}
-	return rc;
+	return 0;
 }
 
 static void be_mcc_queues_destroy(struct be_adapter *adapter)
-- 
1.7.4

  parent reply	other threads:[~2012-02-24  4:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24  4:50 [net-next PATCH 0/5] be2net: fixes Sathya Perla
2012-02-24  4:50 ` [net-next PATCH 1/5] be2net: cancel be_worker during EEH recovery Sathya Perla
2012-02-24  4:50 ` [net-next PATCH 2/5] be2net: fix tx completion cleanup Sathya Perla
2012-02-24  4:50 ` Sathya Perla [this message]
2012-02-24  4:50 ` [net-next PATCH 4/5] be2net: enable RSS for ipv6 pkts Sathya Perla
2012-02-24  4:50 ` [net-next PATCH 5/5] be2net: update driver version Sathya Perla
2012-02-24  6:51 ` [net-next PATCH 0/5] be2net: 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=1330059017-5976-4-git-send-email-sathya.perla@emulex.com \
    --to=sathya.perla@emulex.com \
    --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).