From bc01886352c277e310c07befadbb617c8f561b89 Mon Sep 17 00:00:00 2001
From: Chen Gong <g.chen@freescale.com>
Date: Thu, 5 Jun 2008 21:50:04 +0800
Subject: [PATCH] [MTD] m25p80.c mutex unlock fix

fix a mutex release bug in function m25p80_write.

Signed-off-by: Chen Gong <g.chen@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
 drivers/mtd/devices/m25p80.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 25efd331ef28c..b402269301f6f 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -346,8 +346,10 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
 	mutex_lock(&flash->lock);
 
 	/* Wait until finished previous write command. */
-	if (wait_till_ready(flash))
+	if (wait_till_ready(flash)) {
+		mutex_unlock(&flash->lock);
 		return 1;
+	}
 
 	write_enable(flash);
 
-- 
GitLab