diff options
author | Adrian Hunter <adrian.hunter@nokia.com> | 2009-03-04 02:53:40 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-03-20 14:39:25 -0400 |
commit | 48ec00ac895074f8a47bda8f3925ccaa46abb7a8 (patch) | |
tree | ed31424afc0b44d209185ff24e0852d9e321f86d /drivers/mtd/mtdoops.c | |
parent | e2a0f25b4f520adbd82c0caafcde0470ed11053d (diff) |
[MTD] mtdoops: fix a bit of spin lock usage
- 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>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdoops.c')
-rw-r--r-- | drivers/mtd/mtdoops.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index fdf504fb319a..1060337c06df 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c | |||
@@ -361,8 +361,10 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count) | |||
361 | spin_lock_irqsave(&cxt->writecount_lock, flags); | 361 | spin_lock_irqsave(&cxt->writecount_lock, flags); |
362 | 362 | ||
363 | /* Check ready status didn't change whilst waiting for the lock */ | 363 | /* Check ready status didn't change whilst waiting for the lock */ |
364 | if (!cxt->ready) | 364 | if (!cxt->ready) { |
365 | spin_unlock_irqrestore(&cxt->writecount_lock, flags); | ||
365 | return; | 366 | return; |
367 | } | ||
366 | 368 | ||
367 | if (cxt->writecount == 0) { | 369 | if (cxt->writecount == 0) { |
368 | u32 *stamp = cxt->oops_buf; | 370 | u32 *stamp = cxt->oops_buf; |
@@ -420,6 +422,7 @@ static int __init mtdoops_console_init(void) | |||
420 | 422 | ||
421 | cxt->mtd_index = -1; | 423 | cxt->mtd_index = -1; |
422 | cxt->oops_buf = vmalloc(OOPS_PAGE_SIZE); | 424 | cxt->oops_buf = vmalloc(OOPS_PAGE_SIZE); |
425 | spin_lock_init(&cxt->writecount_lock); | ||
423 | 426 | ||
424 | if (!cxt->oops_buf) { | 427 | if (!cxt->oops_buf) { |
425 | printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n"); | 428 | printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n"); |