mtdoops: fix a bit of spin lock usage
PATCH 1/1 mtdoops: fix a bit of spin lock usage
- do not leave spin lock locked
- initialise spin lock
Signed-off-by Adrian Hunter <[email protected]>
---drivers/mtd/mtdoops.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
drivers/mtd/mtdoops.c +0 -0
@@ -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");Signature · 1 line
1.5.6.3
Quoted 5 lines · Adrian Hunter
- do not leave spin lock locked
- initialise spin lockSigned-off-by Adrian Hunter <[email protected]>---
Acked-by Artem Bityutskiy <[email protected]>
Signature · 2 lines
Best regards, Artem Bityutskiy (Битюцкий Артём)
Quoted 5 lines · Adrian Hunter
- do not leave spin lock locked
- initialise spin lockSigned-off-by Adrian Hunter <[email protected]>---
David, would you please push this patch?
Signature · 2 lines
Best regards, Artem Bityutskiy (Битюцкий Артём)