From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752889AbbJBNSh (ORCPT ); Fri, 2 Oct 2015 09:18:37 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34086 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018AbbJBNSe (ORCPT ); Fri, 2 Oct 2015 09:18:34 -0400 From: Chandra S Gorentla To: gregkh@linuxfoundation.org Cc: johnny.kim@atmel.com, rachel.kim@atmel.com, chris.park@atmel.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, dan.carpenter@oracle.com, Chandra S Gorentla Subject: [PATCH 3/3] drivers: staging: wilc1000: Do not return from function with lock is on Date: Fri, 2 Oct 2015 18:47:37 +0530 Message-Id: <1443791857-7837-3-git-send-email-csgorentla@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443791857-7837-2-git-send-email-csgorentla@gmail.com> References: <1443791857-7837-1-git-send-email-csgorentla@gmail.com> <1443791857-7837-2-git-send-email-csgorentla@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a couple of return statements before unlock. Lock is moved to a location just before queue manipulation. Signed-off-by: Chandra S Gorentla --- drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index a9c28ad..2fa3792 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -72,8 +72,6 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, goto ERRORHANDLER; } - spin_lock_irqsave(&pHandle->strCriticalSection, flags); - /* construct a new message */ pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC); if (!pstrMessage) @@ -88,6 +86,8 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); /* add it to the message queue */ + spin_lock_irqsave(&pHandle->strCriticalSection, flags); + if (!pHandle->pstrMessageList) { pHandle->pstrMessageList = pstrMessage; } else { -- 2.1.4