atheros[ar2315-spiflash]: print detected flash size
[openwrt/svn-archive/archive.git] / target / linux / atheros / patches-3.10 / 141-redboot_partition_scan.patch
1 --- a/drivers/mtd/redboot.c
2 +++ b/drivers/mtd/redboot.c
3 @@ -79,12 +79,18 @@ static int parse_redboot_partitions(stru
4 static char nullstring[] = "unallocated";
5 #endif
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 @@ -97,10 +103,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 @@ -173,6 +175,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;