All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Miquel Raynal <miquel.raynal@bootlin.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: Sat, 17 Apr 2021 13:24:26 +0300	[thread overview]
Message-ID: <20210417102426.GP6048@kadam> (raw)
In-Reply-To: <20210416170040.4e467039@xps13>

On Fri, Apr 16, 2021 at 05:00:40PM +0200, Miquel Raynal wrote:
> 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.
> 

If we decided that the original code is correct then one way to silence
the warning would be to do:

	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 = 0;
		goto err_reset_chip;
	}

Setting "ret = 0;" right before the goto makes the code look more
intentional to human readers as well.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Miquel Raynal <miquel.raynal@bootlin.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: Sat, 17 Apr 2021 13:24:26 +0300	[thread overview]
Message-ID: <20210417102426.GP6048@kadam> (raw)
In-Reply-To: <20210416170040.4e467039@xps13>

On Fri, Apr 16, 2021 at 05:00:40PM +0200, Miquel Raynal wrote:
> 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.
> 

If we decided that the original code is correct then one way to silence
the warning would be to do:

	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 = 0;
		goto err_reset_chip;
	}

Setting "ret = 0;" right before the goto makes the code look more
intentional to human readers as well.

regards,
dan carpenter


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

  reply	other threads:[~2021-04-17 10:25 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
2021-04-16 15:00   ` Miquel Raynal
2021-04-17 10:24   ` Dan Carpenter [this message]
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=20210417102426.GP6048@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=boris.brezillon@collabora.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --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.