upgrade orion to 2.6.26-rc9
[openwrt.git] / target / linux / atheros / patches-2.6.25 / 140-redboot_partition_scan.patch
1 Index: linux-2.6.25.4/drivers/mtd/redboot.c
2 ===================================================================
3 --- linux-2.6.25.4.orig/drivers/mtd/redboot.c
4 +++ linux-2.6.25.4/drivers/mtd/redboot.c
5 @@ -59,31 +59,32 @@ static int parse_redboot_partitions(stru
6 static char nullstring[] = "unallocated";
7 #endif
8
9 + buf = vmalloc(master->erasesize);
10 + if (!buf)
11 + return -ENOMEM;
12 +
13 + restart:
14 if ( directory < 0 ) {
15 offset = master->size + directory * master->erasesize;
16 - while (master->block_isbad &&
17 + while (master->block_isbad &&
18 master->block_isbad(master, offset)) {
19 if (!offset) {
20 nogood:
21 printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
22 + vfree(buf);
23 return -EIO;
24 }
25 offset -= master->erasesize;
26 }
27 } else {
28 offset = directory * master->erasesize;
29 - while (master->block_isbad &&
30 + while (master->block_isbad &&
31 master->block_isbad(master, offset)) {
32 offset += master->erasesize;
33 if (offset == master->size)
34 goto nogood;
35 }
36 }
37 - buf = vmalloc(master->erasesize);
38 -
39 - if (!buf)
40 - return -ENOMEM;
41 -
42 printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
43 master->name, offset);
44
45 @@ -155,6 +156,11 @@ static int parse_redboot_partitions(stru
46 }
47 if (i == numslots) {
48 /* Didn't find it */
49 + if (offset + master->erasesize < master->size) {
50 + /* not at the end of the flash yet, maybe next block :) */
51 + directory++;
52 + goto restart;
53 + }
54 printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
55 master->name);
56 ret = 0;
This page took 0.047866 seconds and 5 git commands to generate.