Patchwork [03/13] mtd: sst25l, fix lock imbalance

login
register
mail settings
Submitter Andrew Morton
Date Sept. 18, 2009, 7:51 p.m.
Message ID <200909181951.n8IJpgkX023541@imap1.linux-foundation.org>
Download mbox | patch
Permalink /patch/33878/
State New
Headers show

Comments

Andrew Morton - Sept. 18, 2009, 7:51 p.m.
From: Jiri Slaby <jirislaby@gmail.com>

Add an omitted unlock to one sst25l_erase fail path.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/devices/sst25l.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff -puN drivers/mtd/devices/sst25l.c~mtd-sst25l-fix-lock-imbalance drivers/mtd/devices/sst25l.c
--- a/drivers/mtd/devices/sst25l.c~mtd-sst25l-fix-lock-imbalance
+++ a/drivers/mtd/devices/sst25l.c
@@ -180,8 +180,10 @@  static int sst25l_erase(struct mtd_info 
 	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);