From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: vadivel.muruganx.ramuthevar@linux.intel.com,
linux-mtd@lists.infradead.org, vigneshr@ti.com,
linux-kernel@vger.kernel.org, richard@nod.at
Subject: Re: [PATCH] mtd: rawnand: intel: remove broken code
Date: Mon, 4 Jan 2021 09:48:49 +0100 [thread overview]
Message-ID: <20210104094849.1850c993@xps13> (raw)
In-Reply-To: <20201217221148.2877318-1-martin.blumenstingl@googlemail.com>
Hi Martin,
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote on Thu,
17 Dec 2020 23:11:48 +0100:
> Drop the check for mtd->name as it's executed while the mtd variable is
> always NULL. If some MTD name is needed then it should be validated by
> the MTD core.
>
> While here, also drop the NULL assignment to the mtd variable as it's
> overwritten later on anyways and the NULL value is never read.
>
> Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> I found this by looking at the new driver. This patch is compile-tested
> only.
>
>
> drivers/mtd/nand/raw/intel-nand-controller.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
> index fdb112e8a90d..398de6ec68d7 100644
> --- a/drivers/mtd/nand/raw/intel-nand-controller.c
> +++ b/drivers/mtd/nand/raw/intel-nand-controller.c
> @@ -579,7 +579,7 @@ static int ebu_nand_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct ebu_nand_controller *ebu_host;
> struct nand_chip *nand;
> - struct mtd_info *mtd = NULL;
> + struct mtd_info *mtd;
> struct resource *res;
> char *resname;
> int ret;
> @@ -647,10 +647,6 @@ static int ebu_nand_probe(struct platform_device *pdev)
> ebu_host->ebu + EBU_ADDR_SEL(cs));
>
> nand_set_flash_node(&ebu_host->chip, dev->of_node);
> - if (!mtd->name) {
> - dev_err(ebu_host->dev, "NAND label property is mandatory\n");
> - return -EINVAL;
> - }
This is valid code, it's best to use a label = "my-storage"; property
in your NAND DT node. Then mtd->name will be updated by
nand_set_flash_node().
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: vadivel.muruganx.ramuthevar@linux.intel.com,
linux-mtd@lists.infradead.org, richard@nod.at, vigneshr@ti.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: intel: remove broken code
Date: Mon, 4 Jan 2021 09:48:49 +0100 [thread overview]
Message-ID: <20210104094849.1850c993@xps13> (raw)
In-Reply-To: <20201217221148.2877318-1-martin.blumenstingl@googlemail.com>
Hi Martin,
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote on Thu,
17 Dec 2020 23:11:48 +0100:
> Drop the check for mtd->name as it's executed while the mtd variable is
> always NULL. If some MTD name is needed then it should be validated by
> the MTD core.
>
> While here, also drop the NULL assignment to the mtd variable as it's
> overwritten later on anyways and the NULL value is never read.
>
> Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> I found this by looking at the new driver. This patch is compile-tested
> only.
>
>
> drivers/mtd/nand/raw/intel-nand-controller.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
> index fdb112e8a90d..398de6ec68d7 100644
> --- a/drivers/mtd/nand/raw/intel-nand-controller.c
> +++ b/drivers/mtd/nand/raw/intel-nand-controller.c
> @@ -579,7 +579,7 @@ static int ebu_nand_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct ebu_nand_controller *ebu_host;
> struct nand_chip *nand;
> - struct mtd_info *mtd = NULL;
> + struct mtd_info *mtd;
> struct resource *res;
> char *resname;
> int ret;
> @@ -647,10 +647,6 @@ static int ebu_nand_probe(struct platform_device *pdev)
> ebu_host->ebu + EBU_ADDR_SEL(cs));
>
> nand_set_flash_node(&ebu_host->chip, dev->of_node);
> - if (!mtd->name) {
> - dev_err(ebu_host->dev, "NAND label property is mandatory\n");
> - return -EINVAL;
> - }
This is valid code, it's best to use a label = "my-storage"; property
in your NAND DT node. Then mtd->name will be updated by
nand_set_flash_node().
Thanks,
Miquèl
next prev parent reply other threads:[~2021-01-04 8:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 22:11 [PATCH] mtd: rawnand: intel: remove broken code Martin Blumenstingl
2020-12-17 22:11 ` Martin Blumenstingl
2021-01-04 8:48 ` Miquel Raynal [this message]
2021-01-04 8:48 ` Miquel Raynal
2021-01-04 13:13 ` Martin Blumenstingl
2021-01-04 13:13 ` Martin Blumenstingl
2021-01-04 13:19 ` Miquel Raynal
2021-01-04 13:19 ` Miquel Raynal
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=20210104094849.1850c993@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=richard@nod.at \
--cc=vadivel.muruganx.ramuthevar@linux.intel.com \
--cc=vigneshr@ti.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.