blob: 087ee97cc2d599f32e1627e1b09c697e9447f21d [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From: Felix Fietkau <nbd@nbd.name>
2Date: Thu, 22 Feb 2018 11:11:57 +0100
3Subject: [PATCH] mtd: spi-nor: allow NOR driver to write fewer bytes than
4 requested
5
6The write size can be constrained by the maximum message/transfer size
7of the SPI controller. Only check for ret = 0 to avoid an infinite loop.
8
9Signed-off-by: Felix Fietkau <nbd@nbd.name>
10---
11
12--- a/drivers/mtd/spi-nor/spi-nor.c
13+++ b/drivers/mtd/spi-nor/spi-nor.c
14@@ -2708,7 +2708,7 @@ static int spi_nor_write(struct mtd_info
15
16 write_enable(nor);
17 ret = spi_nor_write_data(nor, addr, page_remain, buf + i);
18- if (ret < 0)
19+ if (ret <= 0)
20 goto write_err;
21 written = ret;
22