u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Pratyush Yadav <p.yadav@ti.com>
To: "Marek Behún" <kabel@kernel.org>
Cc: "Jagan Teki" <jagan@amarulasolutions.com>,
	"Tom Rini" <trini@konsulko.com>,
	u-boot@lists.denx.de,
	"Patrick Delaunay" <patrick.delaunay@st.com>,
	"Pali Rohár" <pali@kernel.org>,
	"Patrice Chotard" <patrice.chotard@foss.st.com>,
	"Marek Vasut" <marex@denx.de>, "Marek Behún" <marek.behun@nic.cz>,
	"Simon Glass" <sjg@chromium.org>,
	"Masami Hiramatsu" <masami.hiramatsu@linaro.org>
Subject: Re: [PATCH u-boot-spi v2 5/9] mtd: spi-nor-core: Don't check for zero length in spi_nor_erase()
Date: Tue, 28 Sep 2021 22:29:11 +0530	[thread overview]
Message-ID: <20210928165909.mw627irdzzn743zg@ti.com> (raw)
In-Reply-To: <20210925173318.25804-6-kabel@kernel.org>

On 25/09/21 07:33PM, Marek Behún wrote:
> From: Marek Behún <marek.behun@nic.cz>
> 
> This check is already done in mtdcore's mtd_erase(), no reason to do
> this here as well.

But do we always get here via mtd_erase()? What about "sf erase"? I 
looked at the code and I don't see any checks for 0 length there.

> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> ---
>  drivers/mtd/spi/spi-nor-core.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index 9e936cbe1a..211eea22a4 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -912,9 +912,6 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
>  	dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
>  		(long long)instr->len);
>  
> -	if (!instr->len)
> -		return 0;
> -
>  	div_u64_rem(instr->len, mtd->erasesize, &rem);
>  	if (rem)
>  		return -EINVAL;
> -- 
> 2.32.0
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

  reply	other threads:[~2021-09-28 16:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25 17:33 [PATCH u-boot-spi v2 0/9] Fix `mtd erase` when used with mtdpart Marek Behún
2021-09-25 17:33 ` [PATCH u-boot-spi v2 1/9] mtd: spi-nor-core: Try cleaning up in case writing BAR failed Marek Behún
2021-09-28 16:45   ` Pratyush Yadav
2021-09-25 17:33 ` [PATCH u-boot-spi v2 2/9] mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase() Marek Behún
2021-09-28 16:48   ` Pratyush Yadav
2021-09-25 17:33 ` [PATCH u-boot-spi v2 3/9] mtd: spi-nor-core: Don't overwrite return value if it is non-zero Marek Behún
2021-09-25 17:33 ` [PATCH u-boot-spi v2 4/9] mtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase() Marek Behún
2021-09-25 17:33 ` [PATCH u-boot-spi v2 5/9] mtd: spi-nor-core: Don't check for zero length " Marek Behún
2021-09-28 16:59   ` Pratyush Yadav [this message]
2021-10-01  9:25     ` Marek Behún
2021-10-01 10:30       ` Pratyush Yadav
2021-09-25 17:33 ` [PATCH u-boot-spi v2 6/9] mtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase() Marek Behún
2021-09-25 17:33 ` [PATCH u-boot-spi v2 7/9] mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase() Marek Behún
2021-09-25 17:33 ` [PATCH u-boot-spi v2 8/9] mtd: mtdpart: Make mtdpart's _erase method sane Marek Behún
2021-09-25 17:33 ` [PATCH u-boot-spi v2 9/9] mtd: Remove mtd_erase_callback() entirely Marek Behún

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=20210928165909.mw627irdzzn743zg@ti.com \
    --to=p.yadav@ti.com \
    --cc=jagan@amarulasolutions.com \
    --cc=kabel@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=marex@denx.de \
    --cc=masami.hiramatsu@linaro.org \
    --cc=pali@kernel.org \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@st.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).