sunxi: update a13-olimex-som DTS path
[openwrt/openwrt.git] / target / linux / ath79 / patches-5.4 / 408-mtd-redboot_partition_scan.patch
1 --- a/drivers/mtd/parsers/redboot.c
2 +++ b/drivers/mtd/parsers/redboot.c
3 @@ -85,12 +85,18 @@ static int parse_redboot_partitions(stru
4
5 parse_redboot_of(master);
6
7 + buf = vmalloc(master->erasesize);
8 + if (!buf)
9 + return -ENOMEM;
10 +
11 + restart:
12 if ( directory < 0 ) {
13 offset = master->size + directory * master->erasesize;
14 while (mtd_block_isbad(master, offset)) {
15 if (!offset) {
16 nogood:
17 printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
18 + vfree(buf);
19 return -EIO;
20 }
21 offset -= master->erasesize;
22 @@ -103,10 +109,6 @@ static int parse_redboot_partitions(stru
23 goto nogood;
24 }
25 }
26 - buf = vmalloc(master->erasesize);
27 -
28 - if (!buf)
29 - return -ENOMEM;
30
31 printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
32 master->name, offset);
33 @@ -179,6 +181,11 @@ static int parse_redboot_partitions(stru
34 }
35 if (i == numslots) {
36 /* Didn't find it */
37 + if (offset + master->erasesize < master->size) {
38 + /* not at the end of the flash yet, maybe next block :) */
39 + directory++;
40 + goto restart;
41 + }
42 printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
43 master->name);
44 ret = 0;