[PATCH u-boot-spi v3 06/10] mtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase()
Marek Behún
kabel at kernel.org
Tue Oct 5 15:56:02 CEST 2021
From: Marek Behún <marek.behun at nic.cz>
This check is already done in all callers: mtdcore's mtd_write() /
mtd_erase(), legacy spi_nor_write() / spi_flash_erase(). No reason to do
this here as well.
Signed-off-by: Marek Behún <marek.behun at nic.cz>
---
Changes since v2:
- remove check for zero length also from spi_nor_write()
---
drivers/mtd/spi/spi-nor-core.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index d49f7faf99..4c2590d0c5 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -914,9 +914,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;
@@ -1671,9 +1668,6 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len);
- if (!len)
- return 0;
-
for (i = 0; i < len; ) {
ssize_t written;
loff_t addr = to + i;
--
2.32.0
More information about the U-Boot
mailing list