Skip to contentSkip to conversation

tg3: add missing unlock in tg3_open() error path

PATCH In review Ira Snyder 2 participants 2 messages Nov 21, 2006 – Nov 22, 2006

Subsystems (2)
lore
Share & tools
lore

Ira Snyder

author
#0 lore raw

PATCH 1/1 tg3: add missing unlock in tg3_open() error path

[PATCH] tg3: add missing unlock in tg3_open() error path

Sparse noticed a locking imbalance in tg3_open(). This patch adds an unlock to one of the error paths, so that tg3_open() always exits without the lock held.

---
commit e114d89ecaab99bc175c1db497d9c851e750ca3d
tree d4e82d18cd108d9dea4d01b81890d86c0519048d
parent f84c313680a21fd6c487ac17f69c4c115472e257
author Ira W. Snyder <[email protected]> Mon, 20 Nov 2006 11:03:03 -0800 committer Ira W. Snyder <[email protected]> Mon, 20 Nov 2006 11:03:03 -0800

 drivers/net/tg3.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/tg3.c +3 -1
index 1dbdd6b..c20bb99 100644
@@ -6979,8 +6979,10 @@ static int tg3_open(struct net_device *d
 	tg3_full_lock(tp, 0);
 
 	err = tg3_set_power_state(tp, PCI_D0);
-	if (err)
+	if (err) {
+		tg3_full_unlock(tp);
 		return err;
+	}
 
 	tg3_disable_ints(tp);
 	tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
maintainer
#1 lore raw

From: Ira Snyder <[email protected]>
Date: Tue, 21 Nov 2006 14:23:11 -0800

Quoted 7 lines

[PATCH] tg3: add missing unlock in tg3_open() error path

Sparse noticed a locking imbalance in tg3_open(). This patch adds an unlock to one of the error paths, so that tg3_open() always exits without the lock held.

Nice catch. Patch applied, thanks a lot.