All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>, Han Xu <han.xu@nxp.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Harvey Hunt <harveyhuntnexus@gmail.com>,
	Xiaolei Li <xiaolei.li@mediatek.com>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Marc Gonzalez <marc.w.gonzalez@free.fr>,
	Stefan Agner <stefan@agner.ch>,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>
Subject: [PATCH v2 09/22] mtd: rawnand: ams-delta: cleanup ams_delta_init() error path
Date: Tue,  6 Nov 2018 16:07:57 +0100	[thread overview]
Message-ID: <20181106150810.9569-10-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20181106150810.9569-1-boris.brezillon@bootlin.com>

Remove unused labels, rename out_mtd into err_unmap to make it clearer
and return 0 instead of using a goto out at the end of the registration
procedure.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
Changes in v2:
- None
---
 drivers/mtd/nand/raw/ams-delta.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c
index 8b90132aea43..2f49be4077df 100644
--- a/drivers/mtd/nand/raw/ams-delta.c
+++ b/drivers/mtd/nand/raw/ams-delta.c
@@ -208,8 +208,7 @@ static int ams_delta_init(struct platform_device *pdev)
 	io_base = ioremap(res->start, resource_size(res));
 	if (!io_base) {
 		dev_err(&pdev->dev, "ioremap failed\n");
-		err = -EIO;
-		goto out_free;
+		return -EIO;
 	}
 
 	priv->io_base = io_base;
@@ -222,7 +221,7 @@ static int ams_delta_init(struct platform_device *pdev)
 	if (IS_ERR(priv->gpiod_rdy)) {
 		err = PTR_ERR(priv->gpiod_rdy);
 		dev_warn(&pdev->dev, "RDY GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	this->ecc.mode = NAND_ECC_SOFT;
@@ -235,42 +234,42 @@ static int ams_delta_init(struct platform_device *pdev)
 	if (IS_ERR(priv->gpiod_nwp)) {
 		err = PTR_ERR(priv->gpiod_nwp);
 		dev_err(&pdev->dev, "NWP GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	priv->gpiod_nce = devm_gpiod_get(&pdev->dev, "nce", GPIOD_OUT_HIGH);
 	if (IS_ERR(priv->gpiod_nce)) {
 		err = PTR_ERR(priv->gpiod_nce);
 		dev_err(&pdev->dev, "NCE GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	priv->gpiod_nre = devm_gpiod_get(&pdev->dev, "nre", GPIOD_OUT_HIGH);
 	if (IS_ERR(priv->gpiod_nre)) {
 		err = PTR_ERR(priv->gpiod_nre);
 		dev_err(&pdev->dev, "NRE GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	priv->gpiod_nwe = devm_gpiod_get(&pdev->dev, "nwe", GPIOD_OUT_HIGH);
 	if (IS_ERR(priv->gpiod_nwe)) {
 		err = PTR_ERR(priv->gpiod_nwe);
 		dev_err(&pdev->dev, "NWE GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	priv->gpiod_ale = devm_gpiod_get(&pdev->dev, "ale", GPIOD_OUT_LOW);
 	if (IS_ERR(priv->gpiod_ale)) {
 		err = PTR_ERR(priv->gpiod_ale);
 		dev_err(&pdev->dev, "ALE GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	priv->gpiod_cle = devm_gpiod_get(&pdev->dev, "cle", GPIOD_OUT_LOW);
 	if (IS_ERR(priv->gpiod_cle)) {
 		err = PTR_ERR(priv->gpiod_cle);
 		dev_err(&pdev->dev, "CLE GPIO request failed (%d)\n", err);
-		goto out_mtd;
+		goto err_unmap;
 	}
 
 	/* Initialize data port direction to a known state */
@@ -279,17 +278,16 @@ static int ams_delta_init(struct platform_device *pdev)
 	/* Scan to find existence of the device */
 	err = nand_scan(this, 1);
 	if (err)
-		goto out_mtd;
+		goto err_unmap;
 
 	/* Register the partitions */
 	mtd_device_register(mtd, partition_info, ARRAY_SIZE(partition_info));
 
-	goto out;
+	return 0;
 
- out_mtd:
+err_unmap:
 	iounmap(io_base);
-out_free:
- out:
+
 	return err;
 }
 
-- 
2.17.1

  parent reply	other threads:[~2018-11-06 15:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 15:07 [PATCH v2 00/22] mtd: rawnand: 3rd batch of cleanup Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 01/22] mtd: rawnand: Stop passing mtd_info objects to internal functions Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 02/22] mtd: rawnand: Reorganize code to avoid forward declarations Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 03/22] mtd: rawnand: legacy: Drop useless test in nand_legacy_set_defaults() Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 04/22] mtd: rawnand: Move nand_exec_op() to internal.h Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 05/22] mtd: rawnand: Remove unused NAND_CONTROLLER_ALLOC flag Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 06/22] mtd: rawnand: ams-delta: Allow this driver to be compiled when COMPILE_TEST=y Boris Brezillon
2018-11-06 16:56   ` Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 07/22] mtd: rawnand: ams-delta: Add an SPDX tag to replace the license text Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 08/22] mtd: rawnand: ams-delta: Fix various coding style issues Boris Brezillon
2018-11-06 15:07 ` Boris Brezillon [this message]
2018-11-06 15:07 ` [PATCH v2 10/22] mtd: rawnand: ams-delta: Check mtd_device_register() return code Boris Brezillon
2018-11-06 15:07 ` [PATCH v2 11/22] mtd: rawnand: ams-delta: Explicitly inherit from nand_controller Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 12/22] mtd: rawnand: Add nand_[de]select_target() helpers Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 13/22] mtd: rawnand: Pass the CS line to be selected in struct nand_operation Boris Brezillon
2018-11-10  1:30   ` Janusz Krzysztofik
2018-11-10  8:04     ` Boris Brezillon
2018-11-10  9:33       ` Janusz Krzysztofik
2018-11-06 15:08 ` [PATCH v2 14/22] mtd: rawnand: Make ->select_chip() optional when ->exec_op() is implemented Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 15/22] mtd: rawnand: fsmc: Stop implementing ->select_chip() Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 16/22] mtd: rawnand: marvell: " Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 17/22] mtd: rawnand: tegra: " Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 18/22] mtd: rawnand: vf610: " Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 19/22] mtd: rawnand: ams-delta: " Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 20/22] mtd: rawnand: Deprecate the ->select_chip() hook Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 21/22] mtd: rawnand: Move the ->exec_op() method to nand_controller_ops Boris Brezillon
2018-11-06 15:08 ` [PATCH v2 22/22] mtd: rawnand: Move ->setup_data_interface() " Boris Brezillon

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=20181106150810.9569-10-boris.brezillon@bootlin.com \
    --to=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=han.xu@nxp.com \
    --cc=harveyhuntnexus@gmail.com \
    --cc=jmkrzyszt@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marc.w.gonzalez@free.fr \
    --cc=marek.vasut@gmail.com \
    --cc=maximlevitsky@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=stefan@agner.ch \
    --cc=tudor.ambarus@microchip.com \
    --cc=xiaolei.li@mediatek.com \
    --cc=yamada.masahiro@socionext.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.