diff mbox

[net-next,1/3] bna: Semaphore Lock Fix

Message ID 1316221608-21392-1-git-send-email-rmody@brocade.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Rasesh Mody Sept. 17, 2011, 1:06 a.m. UTC
Remove a BUG_ON() as it is not required.

Change the unconditional write to release a semaphore to read sem first
and then write. This will eliminate the possibility of sem getting locked
while trying to release it in case if previous sem_get operation failed.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/ethernet/brocade/bna/bfa_ioc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

David Miller Sept. 17, 2011, 4:48 a.m. UTC | #1
From: Rasesh Mody <rmody@brocade.com>
Date: Fri, 16 Sep 2011 18:06:46 -0700

> Remove a BUG_ON() as it is not required.
> 
> Change the unconditional write to release a semaphore to read sem first
> and then write. This will eliminate the possibility of sem getting locked
> while trying to release it in case if previous sem_get operation failed.
> 
> Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
> Signed-off-by: Rasesh Mody <rmody@brocade.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 029fb52..4282fef 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -1201,13 +1201,13 @@  bfa_nw_ioc_sem_get(void __iomem *sem_reg)
 	if (!(r32 & 1))
 		return true;
 
-	BUG_ON(!(cnt < BFA_SEM_SPINCNT));
 	return false;
 }
 
 void
 bfa_nw_ioc_sem_release(void __iomem *sem_reg)
 {
+	readl(sem_reg);
 	writel(1, sem_reg);
 }