2020-02-23 12:20:11 +00:00
|
|
|
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
|
2020-04-04 13:23:50 +00:00
|
|
|
@@ -2704,7 +2704,7 @@ static int spi_nor_write(struct mtd_info
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
write_enable(nor);
|
2019-11-25 15:08:31 +00:00
|
|
|
ret = spi_nor_write_data(nor, addr, page_remain, buf + i);
|
2020-02-23 12:20:11 +00:00
|
|
|
- if (ret < 0)
|
|
|
|
+ if (ret <= 0)
|
|
|
|
goto write_err;
|
|
|
|
written = ret;
|
|
|
|
|