]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase()
authorMarek Behún <marek.behun@nic.cz>
Tue, 5 Oct 2021 13:56:02 +0000 (15:56 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Sat, 23 Oct 2021 10:17:33 +0000 (15:47 +0530)
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@nic.cz>
drivers/mtd/spi/spi-nor-core.c

index 30c54cd7b91d2be8eed62bfee8ce867aa9d05c4e..751172d6c9c4d43716faa710e16340627d41a39b 100644 (file)
@@ -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;