public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: boris.brezillon@free-electrons.com
Cc: han.xu@nxp.com, linux-mtd@lists.infradead.org,
	Fabio Estevam <fabio.estevam@nxp.com>
Subject: [PATCH] mtd: nand: gpmi: Release DMA channels on failure
Date: Thu, 28 Dec 2017 16:07:00 -0200	[thread overview]
Message-ID: <1514484420-19344-1-git-send-email-festevam@gmail.com> (raw)

From: Fabio Estevam <fabio.estevam@nxp.com>

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 <fabio.estevam@nxp.com>
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 9 +++++++--
 1 file changed, 7 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..acfa5f5 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -2137,20 +2137,25 @@ 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 */
 
-- 
2.7.4

             reply	other threads:[~2017-12-28 18:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 18:07 Fabio Estevam [this message]
2018-01-10 21:50 ` [PATCH] mtd: nand: gpmi: Release DMA channels on failure Han Xu
2018-01-10 22:04   ` Boris Brezillon
2018-01-10 22:30     ` Han Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1514484420-19344-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=fabio.estevam@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox