All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: fix an error code in nand_setup_interface()
Date: Fri, 16 Apr 2021 17:00:40 +0200	[thread overview]
Message-ID: <20210416170040.4e467039@xps13> (raw)
In-Reply-To: <YHaEEYg2DUFwnxSo@mwanda>

Hi Dan,

Dan Carpenter <dan.carpenter@oracle.com> wrote on Wed, 14 Apr 2021
08:56:33 +0300:

> We should return an error code if the timing mode is not acknowledged
> by the NAND chip.

This truly is questionable (and I am not yet decided whether the answer
should be yes or no).

Returning an error here would produce the entire boot sequence to fail,
even though the NAND chip would work in mode 0.

Not returning an error would print the below warning (so the
user/developer is warned) and continue the boot with the slowest
timing interface.

Honestly I would be more in favor of letting things as they are
because I don't think this may be considered as a buggy situation, but I
am open to discussion.

> Fixes: 415ae78ffb5d ("mtd: rawnand: check ONFI timings have been acked by the chip")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis.  Not tested.
> 
>  drivers/mtd/nand/raw/nand_base.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index fb072c444495..d83c0503f96f 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -880,6 +880,7 @@ static int nand_setup_interface(struct nand_chip *chip, int chipnr)
>  	if (tmode_param[0] != chip->best_interface_config->timings.mode) {
>  		pr_warn("timing mode %d not acknowledged by the NAND chip\n",
>  			chip->best_interface_config->timings.mode);
> +		ret = -EINVAL;
>  		goto err_reset_chip;
>  	}
>  

Thanks,
Miquèl

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: fix an error code in nand_setup_interface()
Date: Fri, 16 Apr 2021 17:00:40 +0200	[thread overview]
Message-ID: <20210416170040.4e467039@xps13> (raw)
In-Reply-To: <YHaEEYg2DUFwnxSo@mwanda>

Hi Dan,

Dan Carpenter <dan.carpenter@oracle.com> wrote on Wed, 14 Apr 2021
08:56:33 +0300:

> We should return an error code if the timing mode is not acknowledged
> by the NAND chip.

This truly is questionable (and I am not yet decided whether the answer
should be yes or no).

Returning an error here would produce the entire boot sequence to fail,
even though the NAND chip would work in mode 0.

Not returning an error would print the below warning (so the
user/developer is warned) and continue the boot with the slowest
timing interface.

Honestly I would be more in favor of letting things as they are
because I don't think this may be considered as a buggy situation, but I
am open to discussion.

> Fixes: 415ae78ffb5d ("mtd: rawnand: check ONFI timings have been acked by the chip")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis.  Not tested.
> 
>  drivers/mtd/nand/raw/nand_base.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index fb072c444495..d83c0503f96f 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -880,6 +880,7 @@ static int nand_setup_interface(struct nand_chip *chip, int chipnr)
>  	if (tmode_param[0] != chip->best_interface_config->timings.mode) {
>  		pr_warn("timing mode %d not acknowledged by the NAND chip\n",
>  			chip->best_interface_config->timings.mode);
> +		ret = -EINVAL;
>  		goto err_reset_chip;
>  	}
>  

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-04-16 15:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  5:56 [PATCH] mtd: rawnand: fix an error code in nand_setup_interface() Dan Carpenter
2021-04-14  5:56 ` Dan Carpenter
2021-04-16 15:00 ` Miquel Raynal [this message]
2021-04-16 15:00   ` Miquel Raynal
2021-04-17 10:24   ` Dan Carpenter
2021-04-17 10:24     ` Dan Carpenter
2021-04-17 12:31     ` Miquel Raynal
2021-04-17 12:31       ` 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=20210416170040.4e467039@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.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.