From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
linux-mtd@lists.infradead.org, Kamal Dasu <kdasu.kdev@gmail.com>
Subject: Re: [PATCH v2 16/16] mtd: rawnand: s3c2410: enhance the probe function error path
Date: Tue, 27 Mar 2018 11:06:50 +0200 [thread overview]
Message-ID: <20180327110650.631da0b8@bbrezillon> (raw)
In-Reply-To: <20180321130157.9524-17-miquel.raynal@bootlin.com>
On Wed, 21 Mar 2018 14:01:57 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> Prepare the migration of the lpc32xx_slc driver to use nand_scan() by
> cleaning the error path in the probe function.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> drivers/mtd/nand/raw/s3c2410.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/s3c2410.c b/drivers/mtd/nand/raw/s3c2410.c
> index b5bc5f106c09..1bc0458063d8 100644
> --- a/drivers/mtd/nand/raw/s3c2410.c
> +++ b/drivers/mtd/nand/raw/s3c2410.c
> @@ -124,13 +124,11 @@ struct s3c2410_nand_info;
> * @chip: The NAND chip information.
> * @set: The platform information supplied for this set of NAND chips.
> * @info: Link back to the hardware information.
> - * @scan_res: The result from calling nand_scan_ident().
> */
> struct s3c2410_nand_mtd {
> struct nand_chip chip;
> struct s3c2410_nand_set *set;
> struct s3c2410_nand_info *info;
> - int scan_res;
> };
>
> enum s3c_cpu_type {
> @@ -1163,17 +1161,19 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
> mtd->dev.parent = &pdev->dev;
> s3c2410_nand_init_chip(info, nmtd, sets);
>
> - nmtd->scan_res = nand_scan_ident(mtd,
> - (sets) ? sets->nr_chips : 1,
> - NULL);
> + err = nand_scan_ident(mtd, (sets) ? sets->nr_chips : 1, NULL);
> + if (err)
> + goto exit_error;
>
> - if (nmtd->scan_res == 0) {
> - err = s3c2410_nand_update_chip(info, nmtd);
> - if (err < 0)
> - goto exit_error;
> - nand_scan_tail(mtd);
> - s3c2410_nand_add_partition(info, nmtd, sets);
> - }
> + err = s3c2410_nand_update_chip(info, nmtd);
> + if (err < 0)
> + goto exit_error;
> +
> + err = nand_scan_tail(mtd);
> + if (err)
> + goto exit_error;
> +
> + s3c2410_nand_add_partition(info, nmtd, sets);
Not related to this patch, but it seems this we're ignoring the return
value of s3c2410_nand_add_partition(). Don't know if this is
intentional.
And there's something even weirder: s3c2410_nand_add_partition() only
registers the MTD device if sets != NULL, so what's the point of
scanning the bus if we know we'll not register the NAND chips we find
there? Looks like this probe path is overly complex for no real reason.
Anyway, I'll take your patch since it tends to improve a bit the code.
>
> if (sets != NULL)
> sets++;
--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-03-27 9:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 13:01 [PATCH v2 00/16] Fix probe functions error path Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 01/16] mtd: rawnand: brcmnand: fix probe function " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 02/16] mtd: rawnand: cafe: " Miquel Raynal
2018-03-27 8:02 ` Boris Brezillon
2018-03-21 13:01 ` [PATCH v2 03/16] mtd: rawnand: davinci: " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 04/16] mtd: rawnand: denali: " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 05/16] mtd: rawnand: docg4: fix the " Miquel Raynal
2018-03-27 7:59 ` Boris Brezillon
2018-03-21 13:01 ` [PATCH v2 06/16] mtd: rawnand: fsl_elbc: fix " Miquel Raynal
2018-03-27 7:56 ` Boris Brezillon
2018-03-21 13:01 ` [PATCH v2 07/16] mtd: rawnand: fsl_ifc: " Miquel Raynal
2018-03-27 7:57 ` Boris Brezillon
2018-03-21 13:01 ` [PATCH v2 08/16] mtd: rawnand: fsmc: fix and enhance " Miquel Raynal
2018-03-27 8:05 ` Boris Brezillon
2018-03-21 13:01 ` [PATCH v2 09/16] mtd: rawnand: mxc: fix " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 10/16] mtd: rawnand: omap2: fix the " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 11/16] mtd: rawnand: sh_flctl: " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 12/16] mtd: rawnand: tango: fix " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 13/16] mtd: rawnand: hisi504: fix and enhance the " Miquel Raynal
2018-03-27 8:56 ` Boris Brezillon
2018-03-21 13:01 ` [PATCH v2 14/16] mtd: rawnand: lpc32xx_mlc: " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 15/16] mtd: rawnand: lpc32xx_slc: " Miquel Raynal
2018-03-21 13:01 ` [PATCH v2 16/16] mtd: rawnand: s3c2410: " Miquel Raynal
2018-03-27 9:06 ` Boris Brezillon [this message]
2018-04-21 17:56 ` Miquel Raynal
2018-03-28 8:38 ` [PATCH v2 00/16] Fix probe functions " 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=20180327110650.631da0b8@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=kdasu.kdev@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox