netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ameen.rahman@qlogic.com
Subject: [PATCH NEXT 5/8] qlcnic: fix pci semaphore checks
Date: Thu, 22 Apr 2010 05:51:39 -0700	[thread overview]
Message-ID: <1271940702-17064-6-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1271940702-17064-1-git-send-email-amit.salecha@qlogic.com>

Driver should not go ahead with fw recovery if fails to acquire
semaphore.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic_main.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 3c8a963..bfc5510 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -1949,8 +1949,8 @@ static void qlcnic_poll_controller(struct net_device *netdev)
 }
 #endif
 
-static void
-qlcnic_set_drv_state(struct qlcnic_adapter *adapter, int state)
+static int
+qlcnic_set_drv_state(struct qlcnic_adapter *adapter, u8 state)
 {
 	u32  val;
 
@@ -1958,7 +1958,7 @@ qlcnic_set_drv_state(struct qlcnic_adapter *adapter, int state)
 			state != QLCNIC_DEV_NEED_QUISCENT);
 
 	if (qlcnic_api_lock(adapter))
-		return ;
+		return -EIO;
 
 	val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE);
 
@@ -1970,6 +1970,8 @@ qlcnic_set_drv_state(struct qlcnic_adapter *adapter, int state)
 	QLCWR32(adapter, QLCNIC_CRB_DRV_STATE, val);
 
 	qlcnic_api_unlock(adapter);
+
+	return 0;
 }
 
 static int
@@ -2195,7 +2197,8 @@ qlcnic_detach_work(struct work_struct *work)
 	if (adapter->temp == QLCNIC_TEMP_PANIC)
 		goto err_ret;
 
-	qlcnic_set_drv_state(adapter, adapter->dev_state);
+	if (qlcnic_set_drv_state(adapter, adapter->dev_state))
+		goto err_ret;
 
 	adapter->fw_wait_cnt = 0;
 
-- 
1.6.0.2


  parent reply	other threads:[~2010-04-22 12:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 12:51 [PATCH NEXT 0/8]qlcnic: inter driver coexistence fixes Amit Kumar Salecha
2010-04-22 12:51 ` [PATCH NEXT 1/8] qlcnic: additional driver statistics Amit Kumar Salecha
2010-04-22 12:51 ` [PATCH NEXT 2/8] qlcnic: fix defines as per IDC document Amit Kumar Salecha
2010-04-22 12:51 ` [PATCH NEXT 3/8] qlcnic: fix fw initialization responsibility Amit Kumar Salecha
2010-04-22 12:51 ` [PATCH NEXT 4/8] qlcnic: define macro for driver state Amit Kumar Salecha
2010-04-22 12:51 ` Amit Kumar Salecha [this message]
2010-04-22 12:51 ` [PATCH NEXT 6/8] qlcnic: fix rcv buffer leak Amit Kumar Salecha
2010-04-22 12:51 ` [PATCH NEXT 7/8] qlcnic: protect resource access Amit Kumar Salecha
2010-04-22 12:51 ` [PATCH NEXT 8/8] qlcnic: update version 5.0.2 Amit Kumar Salecha
2010-04-23  3:54 ` [PATCH NEXT 0/8]qlcnic: inter driver coexistence 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=1271940702-17064-6-git-send-email-amit.salecha@qlogic.com \
    --to=amit.salecha@qlogic.com \
    --cc=ameen.rahman@qlogic.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).