Patchwork MTD: sst25l, fix lock imbalance

login
register
mail settings
Submitter Jiri Slaby
Date July 13, 2009, 9:22 p.m.
Message ID <1247520124-31875-1-git-send-email-jirislaby@gmail.com>
Download mbox | patch
Permalink /patch/29750/
State Accepted
Commit 2eaaa5ff87c675aacd3a869fc5fe75a35bbd5278
Headers show

Comments

Jiri Slaby - July 13, 2009, 9:22 p.m.
Add an omitted unlock to one sst25l_erase fail path.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/mtd/devices/sst25l.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index 1648685..5022ab2 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -180,8 +180,10 @@  static int sst25l_erase(struct mtd_info *mtd, struct erase_info *instr)
 	mutex_lock(&flash->lock);
 
 	err = sst25l_wait_till_ready(flash);
-	if (err)
+	if (err) {
+		mutex_unlock(&flash->lock);
 		return err;
+	}
 
 	while (addr < end) {
 		err = sst25l_erase_sector(flash, addr);