From patchwork Thu Dec 28 18:17:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 853503 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z+G82zcp"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MWnZDvxM"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z6ydw1PSxz9rxj for ; Fri, 29 Dec 2017 05:18:44 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Abb5UEWDcor1IpAUJqqZuFOUxEbL/seivewaaeItpTc=; b=Z+G 82zcpibQjFapVv1VfWjlyV/msnt26Py21ggybxLwUXk2gN2c5MMRVARiYoCK1BezUFGgmirb7klhj z46WCw2KXGlnEhm2KIVN7zJr8vLpWgLnNl/Dgb4sG/wnBP4ycPykNFgPOytoJmBn2DB7hjOG6E1Nb tJQUWR3FGsOlOLlN0vyCSpTIidtqX8amfXIA+9mI2f53B4hCrP1+XNvp/S4m+P2t7uL70ON7ZZD85 S9vY8/36BCWMb/u7U0uSK2bXKCNoQl8R9Rltc667xqiAkikQJCfwn84vc9pppXo6DVjGJpgcOjB2E Yu8RFF8PWelcvaApSWzTtM+kMRDlvpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eUclC-0001Vb-LB; Thu, 28 Dec 2017 18:18:30 +0000 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eUcl6-0001TH-NJ for linux-mtd@lists.infradead.org; Thu, 28 Dec 2017 18:18:28 +0000 Received: by mail-qk0-x242.google.com with SMTP id d202so26025857qkc.9 for ; Thu, 28 Dec 2017 10:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=JCX1JF+o4lfuEefgQIM18uwg7AbRpAsouIwiqhwiWcQ=; b=MWnZDvxMiN6POE9LvD5K1rLEPLAwew3N53o0P9fyI52hhi5ieQb4Xc+1yxYb4mQSQU kYbHrDAKqxA4BUhmM2gKPVZjfuyr4eC7MVf5ac/s98qBD1zYn6z4GxQbQa0XQkwrj959 jMMypAz1x3xXdx6esUiiwE/bEmzpK8n7q2o/0b2R5HFjoH95iE/yHWhlZFly/Ro8aQ55 SPMi3Z4pXwo4pmReRgOHdO0eFvL5DVl+YbhkibU5iBBq0C1mDM8p2DC0UfgxL+AkFLMC 7XLKaoerROU1Ds6+225zGVwRYGehTVg3HAms311yYTpVezFM2IGImZPsnbHnMpfnAOOE 51nw== 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=JCX1JF+o4lfuEefgQIM18uwg7AbRpAsouIwiqhwiWcQ=; b=e40Wu9gZUGRuu0Oa+M3UxIQ0pG3yme+/nVegJoehtpheeFo3cSJle+8R0aKyrcmtNd +R0Pm7heJmDPht54Oe1QBSVK4SRhWxp6sdr4GFLssaV5dSWo+LC0aQaQMsgSIQhPnWi3 nFkJwQjPpTrWeTF15E7ykxgULwCLNyV8cUaES5+gNAbrbQRfqjqO34Hqhf+zV1j3+fjs +M91/eV6ElRkgcBwn11zplpWHJzmk/sodVCRM+h+dLGjaXjeicL3c67UPAiulU2h4qNX J4IC1o6xuuM+Uu21TeZt3uGmNX55VZ45KtAvv2PUWLZ8kRFQjpTJmxtPH0q+wKrt5Aha cyog== X-Gm-Message-State: AKGB3mIq7mKYxTd2HA8acK2m2DiXh5LUrkWFT9j4+51glV/OTFMv9dLD A9EzPmW+c3S2uxRmrCgI5pM= X-Google-Smtp-Source: ACJfBou++RwjDl7JSDuhEbNQvu6jafBuAfzTDhilV7Ix1ZIiRwUaxwJ+IyyQ6CFyrqAilhRW/GkTVA== X-Received: by 10.55.24.3 with SMTP id j3mr35864264qkh.123.1514485091542; Thu, 28 Dec 2017 10:18:11 -0800 (PST) Received: from localhost.localdomain ([187.180.183.156]) by smtp.gmail.com with ESMTPSA id a71sm16671983qkc.60.2017.12.28.10.18.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Dec 2017 10:18:11 -0800 (PST) From: Fabio Estevam To: boris.brezillon@free-electrons.com Subject: [PATCH v2] mtd: nand: gpmi: Release DMA channels on failure Date: Thu, 28 Dec 2017 16:17:58 -0200 Message-Id: <1514485078-19762-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171228_101824_935127_6995BF75 X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400d:c09:0:0:0:242 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabio Estevam , han.xu@nxp.com, linux-mtd@lists.infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Fabio Estevam release_dma_channels() should be called in the case of error in gpmi_init() or bch_set_geometry(), because acquire_dma_channels() has been called previously. Handle the error cases correctly. Signed-off-by: Fabio Estevam --- Changes since v1: - Remove extra blank line drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 2ef8979..db0d924 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -2137,20 +2137,24 @@ static int gpmi_pm_resume(struct device *dev) ret = gpmi_init(this); if (ret) { dev_err(this->dev, "Error setting GPMI : %d\n", ret); - return ret; + goto release_dma_channels; } /* re-init the BCH registers */ ret = bch_set_geometry(this); if (ret) { dev_err(this->dev, "Error setting BCH : %d\n", ret); - return ret; + goto release_dma_channels; } /* re-init others */ gpmi_extra_init(this); return 0; + +release_dma_channels: + release_dma_channels(this); + return ret; } #endif /* CONFIG_PM_SLEEP */