diff mbox

mtdoops: fix a bit of spin lock usage

Message ID 49AE3384.6040008@nokia.com
State Accepted
Commit 48ec00ac895074f8a47bda8f3925ccaa46abb7a8
Headers show

Commit Message

Adrian Hunter March 4, 2009, 7:53 a.m. UTC
- do not leave spin lock locked
- initialise spin lock

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 drivers/mtd/mtdoops.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Artem Bityutskiy March 4, 2009, 10:08 a.m. UTC | #1
On Wed, 2009-03-04 at 09:53 +0200, Adrian Hunter wrote:
> - do not leave spin lock locked
> - initialise spin lock
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
> ---

Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy March 5, 2009, 10:29 a.m. UTC | #2
On Wed, 2009-03-04 at 09:53 +0200, Adrian Hunter wrote:
> - do not leave spin lock locked
> - initialise spin lock
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
> ---

David, would you please push this patch?
diff mbox

Patch

diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 0a0dad6..3f63fad 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -358,8 +358,10 @@  mtdoops_console_write(struct console *co, const char *s, unsigned int count)
 	spin_lock_irqsave(&cxt->writecount_lock, flags);
 
 	/* Check ready status didn't change whilst waiting for the lock */
-	if (!cxt->ready)
+	if (!cxt->ready) {
+		spin_unlock_irqrestore(&cxt->writecount_lock, flags);
 		return;
+	}
 
 	if (cxt->writecount == 0) {
 		u32 *stamp = cxt->oops_buf;
@@ -417,6 +419,7 @@  static int __init mtdoops_console_init(void)
 
 	cxt->mtd_index = -1;
 	cxt->oops_buf = vmalloc(OOPS_PAGE_SIZE);
+	spin_lock_init(&cxt->writecount_lock);
 
 	if (!cxt->oops_buf) {
 		printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n");