public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: nand: gpmi: Release DMA channels on failure
@ 2017-12-28 18:17 Fabio Estevam
  2018-01-06 10:03 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2017-12-28 18:17 UTC (permalink / raw)
  To: boris.brezillon; +Cc: han.xu, linux-mtd, Fabio Estevam

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>
---
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 */
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-06 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-28 18:17 [PATCH v2] mtd: nand: gpmi: Release DMA channels on failure Fabio Estevam
2018-01-06 10:03 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox