All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/4] nand: raw: Do not free xnand structure
Date: Wed, 26 Feb 2020 11:38:40 +0100	[thread overview]
Message-ID: <63946d0224eb220785b6ef42913891e495a0e214.1582713521.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1582713521.git.michal.simek@xilinx.com>

xnand structure is private data structure and it is handled by core and
probe shouldn't touch it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2: None

 drivers/mtd/nand/raw/zynq_nand.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 28db4153f5e0..703914969289 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -1081,18 +1081,18 @@ static int zynq_nand_probe(struct udevice *dev)
 	u8 set_feature[4] = {ONDIE_ECC_FEATURE_ENABLE, 0x00, 0x00, 0x00};
 	unsigned long ecc_cfg;
 	int ondie_ecc_enabled = 0;
-	int err = -1;
 	int is_16bit_bw;
 
 	smc->reg = (struct zynq_nand_smc_regs *)dev_read_addr(dev);
 	of_nand = dev_read_subnode(dev, "flash at e1000000");
 	if (!ofnode_valid(of_nand)) {
 		printf("Failed to find nand node in dt\n");
-		goto fail;
+		return -ENODEV;
 	}
+
 	if (ofnode_read_resource(of_nand, 0, &res)) {
 		printf("Failed to get nand resource\n");
-		goto fail;
+		return -ENODEV;
 	}
 
 	xnand->nand_base = (void __iomem *)res.start;
@@ -1119,7 +1119,7 @@ static int zynq_nand_probe(struct udevice *dev)
 	if (is_16bit_bw == NAND_BW_UNKNOWN) {
 		printf("%s: Unable detect NAND based on MIO settings\n",
 		       __func__);
-		goto fail;
+		return -EINVAL;
 	}
 
 	if (is_16bit_bw == NAND_BW_16BIT)
@@ -1130,13 +1130,13 @@ static int zynq_nand_probe(struct udevice *dev)
 	/* Initialize the NAND flash interface on NAND controller */
 	if (zynq_nand_init_nand_flash(mtd, nand_chip->options) < 0) {
 		printf("%s: nand flash init failed\n", __func__);
-		goto fail;
+		return -EINVAL;
 	}
 
 	/* first scan to find the device and get the page size */
 	if (nand_scan_ident(mtd, 1, NULL)) {
 		printf("%s: nand_scan_ident failed\n", __func__);
-		goto fail;
+		return -EINVAL;
 	}
 	/* Send the command for reading device ID */
 	nand_chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
@@ -1261,14 +1261,12 @@ static int zynq_nand_probe(struct udevice *dev)
 	/* Second phase scan */
 	if (nand_scan_tail(mtd)) {
 		printf("%s: nand_scan_tail failed\n", __func__);
-		goto fail;
+		return -EINVAL;
 	}
 	if (nand_register(0, mtd))
-		goto fail;
+		return -EINVAL;
+
 	return 0;
-fail:
-	free(xnand);
-	return err;
 }
 
 static const struct udevice_id zynq_nand_dt_ids[] = {
-- 
2.25.1

  reply	other threads:[~2020-02-26 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
2020-02-26 10:38 ` Michal Simek [this message]
2020-04-03 14:44   ` [PATCH v2 1/4] nand: raw: Do not free xnand structure Jagan Teki
2020-02-26 10:38 ` [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled Michal Simek
2020-04-03 14:44   ` Jagan Teki
2020-02-26 10:38 ` [PATCH v2 3/4] ARM: zynq: Do not report NOR flash detection failure Michal Simek
2020-02-26 10:38 ` [PATCH v2 4/4] ARM: zynq: Enable DM for CFI NOR flash Michal Simek
2020-04-06 11:00 ` [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek

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=63946d0224eb220785b6ef42913891e495a0e214.1582713521.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /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.