bna: Semaphore Lock Fix
authorRasesh Mody <rmody@brocade.com>
Fri, 16 Sep 2011 15:06:46 +0000 (15:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Sep 2011 04:47:57 +0000 (00:47 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/brocade/bna/bfa_ioc.c

index 029fb527e80d349c67e1b124f40f87baf1fb94a7..4282fef24f95551b426d784880d859a603a25cc2 100644 (file)
@@ -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);
 }