From patchwork Fri Mar 31 19:10:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasant Jalan X-Patchwork-Id: 9657163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9BD06601D2 for ; Fri, 31 Mar 2017 19:13:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D013286F2 for ; Fri, 31 Mar 2017 19:13:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 805F5286F4; Fri, 31 Mar 2017 19:13:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31294286F2 for ; Fri, 31 Mar 2017 19:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752975AbdCaTNx (ORCPT ); Fri, 31 Mar 2017 15:13:53 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:32858 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbdCaTNw (ORCPT ); Fri, 31 Mar 2017 15:13:52 -0400 Received: by mail-pg0-f68.google.com with SMTP id 79so19377858pgf.0; Fri, 31 Mar 2017 12:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=AdM4hPfbujMMY+d7XLN2wd/kXpuGMFhUNRXCs4sYaWU=; b=R2X2RV7fLznXLD/dG7nzXtQvyVqcdnV7892Myaa3Y+4C0Qorb3fo39hf9KQE59f+w9 4uJ3JKPNkZKsdbA7X3r4H6xZbj7GasUgj712GvTspRLuc+P8UGbwON0g7jTSZq1QJsW2 PVY9s8B6DQXDJ8lfe6aIcZ9bA40tvr9jYdh4v+JvkwFgYZTjGvM7XxGvnfs8oYfIgRBI +/r3+ji1qrvBh3Ou9AkZog3lFZ1w/RWGs9klr3wmRVCLIMJ5eL6u4YKSpTFi9PkrVW7r +pG5gZxqVpO69onwJMKSe3DIf7xcAWv3y70qIUvmVck7/DHpPKLrST+8yCvDVkvqGhMF JVQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AdM4hPfbujMMY+d7XLN2wd/kXpuGMFhUNRXCs4sYaWU=; b=NGeN9RePKRMZ3a531cz43jPG+crul+3wtOzZwwJvFddGrCcjE5Z5mco/KqV9PU1Yjk hAeba5BzpTCuo9MWlDCu1GfOx/AOdpzGyA4CFXzh4+96YlGBPJCMKWyfjMPKDxc7wZVw ORE5ZILncVNrycNS31rdDYSlXKf8+wSPz2LMkhHhvoqk3n3wF3DVZlCK327OcEHyNL5A bKKU+EXzJTq8sucB6ACV0n0Ktd99SmU/KtJoqZhOzfdxMPI4odP9TnR/oPVnLeZWhlEI /C9/pVdSwWrTfiOPEb5gDFPme+DOewyFEThdo+VfaX+f9+GTFTiAHPHwXpTjbmqvaE4z 2SYA== X-Gm-Message-State: AFeK/H16IBDqTGr/V6c+HEbmnbsiuYUizHHvOm3g3uwV4ITYhXINIjAA3UsyVVZTem55EQ== X-Received: by 10.84.237.22 with SMTP id s22mr5107557plk.145.1490987631076; Fri, 31 Mar 2017 12:13:51 -0700 (PDT) Received: from prasant-macvm.localdomain ([106.51.233.19]) by smtp.gmail.com with ESMTPSA id n7sm12029402pfn.0.2017.03.31.12.13.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Mar 2017 12:13:50 -0700 (PDT) Received: by prasant-macvm.localdomain (Postfix, from userid 1000) id C8B63204C9; Sat, 1 Apr 2017 00:40:04 +0530 (IST) From: Prasant Jalan To: sudipm.mukherjee@gmail.com Cc: sudip.mukherjee@codethink.co.uk, teddy.wang@siliconmotion.com, gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Prasant Jalan Subject: [PATCH 1/2] staging: sm750fb: fixing function return with lock held Date: Sat, 1 Apr 2017 00:40:01 +0530 Message-Id: <1490987402-9301-1-git-send-email-prasant.jalan@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP lynxfb_suspend() & lynxfb_resume() return on errors while holding console_lock. Adding 'goto' such that proper cleanups can be done before returning from function and therefore console_lock can be released before returning. Signed-off-by: Prasant Jalan --- drivers/staging/sm750fb/sm750.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index c618c56..445c68d 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -419,7 +419,7 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg) if (ret) { dev_err(&pdev->dev, "error:%d occurred in pci_save_state\n", ret); - return ret; + goto lynxfb_suspend_err; } ret = pci_set_power_state(pdev, pci_choose_state(pdev, mesg)); @@ -427,11 +427,13 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg) dev_err(&pdev->dev, "error:%d occurred in pci_set_power_state\n", ret); - return ret; + goto lynxfb_suspend_err; } } pdev->dev.power.power_state = mesg; + +lynxfb_suspend_err: console_unlock(); return ret; } @@ -456,7 +458,7 @@ static int lynxfb_resume(struct pci_dev *pdev) if (ret) { dev_err(&pdev->dev, "error:%d occurred in pci_set_power_state\n", ret); - return ret; + goto lynxfb_resume_err; } if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { @@ -466,7 +468,7 @@ static int lynxfb_resume(struct pci_dev *pdev) dev_err(&pdev->dev, "error:%d occurred in pci_enable_device\n", ret); - return ret; + goto lynxfb_resume_err; } pci_set_master(pdev); } @@ -498,6 +500,8 @@ static int lynxfb_resume(struct pci_dev *pdev) } pdev->dev.power.power_state.event = PM_EVENT_RESUME; + +lynxfb_resume_err: console_unlock(); return ret; }