From: Felix Fietkau 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 --- --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1377,7 +1377,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; @@ -1386,13 +1386,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: ype='hidden' name='id' value='206bebcad40ceade2a1992c86b29b6645e303764'/> upstream openwrtJames
aboutsummaryrefslogtreecommitdiffstats
blob: a86f4a84061bae979c702601be4a82ad566d0d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59