From patchwork Wed Mar 4 07:53:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 24034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2F092DDFDC for ; Wed, 4 Mar 2009 18:55:51 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Lelvm-0006Zd-Ek; Wed, 04 Mar 2009 07:54:18 +0000 Received: from smtp.nokia.com ([192.100.105.134] helo=mgw-mx09.nokia.com) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1Lelve-0006Z8-MG; Wed, 04 Mar 2009 07:54:13 +0000 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n247rJGc030190; Wed, 4 Mar 2009 01:53:59 -0600 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2009 09:53:34 +0200 Received: from vaebe112.NOE.Nokia.com ([10.160.244.81]) by vaebh104.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2009 09:53:29 +0200 Received: from [172.21.41.224] ([172.21.41.224]) by vaebe112.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2009 09:53:29 +0200 Message-ID: <49AE3384.6040008@nokia.com> Date: Wed, 04 Mar 2009 09:53:40 +0200 From: Adrian Hunter User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: David Woodhouse Subject: [PATCH] mtdoops: fix a bit of spin lock usage X-OriginalArrivalTime: 04 Mar 2009 07:53:29.0535 (UTC) FILETIME=[4EAAC4F0:01C99C9E] X-Nokia-AV: Clean X-Spam-Score: -4.0 (----) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-4.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.100.105.134 listed in list.dnswl.org] Cc: linux-mtd Mailing List X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org - do not leave spin lock locked - initialise spin lock Signed-off-by: Adrian Hunter Acked-by: Artem Bityutskiy --- 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 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");