You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
957 B
36 lines
957 B
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Thu, 22 Feb 2018 11:11:57 +0100
|
|
Subject: [PATCH] mtd: spi-nor: allow NOR driver to write fewer bytes than
|
|
requested
|
|
|
|
The write size can be constrained by the maximum message/transfer size
|
|
of the SPI controller. Only check for ret = 0 to avoid an infinite loop.
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/drivers/mtd/spi-nor/spi-nor.c
|
|
+++ b/drivers/mtd/spi-nor/spi-nor.c
|
|
@@ -1455,7 +1455,7 @@ static int spi_nor_write(struct mtd_info
|
|
|
|
write_enable(nor);
|
|
ret = nor->write(nor, addr, page_remain, buf + i);
|
|
- if (ret < 0)
|
|
+ if (ret <= 0)
|
|
goto write_err;
|
|
written = ret;
|
|
|
|
@@ -1464,13 +1464,6 @@ static int spi_nor_write(struct mtd_info
|
|
goto write_err;
|
|
*retlen += written;
|
|
i += written;
|
|
- if (written != page_remain) {
|
|
- dev_err(nor->dev,
|
|
- "While writing %zu bytes written %zd bytes\n",
|
|
- page_remain, written);
|
|
- ret = -EIO;
|
|
- goto write_err;
|
|
- }
|
|
}
|
|
|
|
write_err:
|
|
|