[cobalt] add missing kernel configuration and patches for 2.6.32
[openwrt.git] / target / linux / atheros / patches-2.6.32 / 140-redboot_partition_scan.patch
1 Index: linux-2.6.32.7/drivers/mtd/redboot.c
2 ===================================================================
3 --- linux-2.6.32.7.orig/drivers/mtd/redboot.c 2010-02-03 16:57:31.582429139 +0100
4 +++ linux-2.6.32.7/drivers/mtd/redboot.c 2010-02-03 17:01:57.067429178 +0100
5 @@ -60,31 +60,32 @@
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 @@ -156,6 +157,11 @@
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.04321 seconds and 5 git commands to generate.