ar71xx: fix legacy image build error
[openwrt/openwrt.git] / target / linux / generic / patches-4.1 / 441-block2mtd_probe.patch
1 --- a/drivers/mtd/devices/block2mtd.c
2 +++ b/drivers/mtd/devices/block2mtd.c
3 @@ -391,7 +391,7 @@ static int block2mtd_setup2(const char *
4 /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */
5 char buf[80 + 12 + 80 + 8];
6 char *str = buf;
7 - char *token[3];
8 + char *token[4];
9 char *name;
10 size_t erase_size = PAGE_SIZE;
11 unsigned long timeout = MTD_DEFAULT_TIMEOUT;
12 @@ -405,7 +405,7 @@ static int block2mtd_setup2(const char *
13 strcpy(str, val);
14 kill_final_newline(str);
15
16 - for (i = 0; i < 3; i++)
17 + for (i = 0; i < 4; i++)
18 token[i] = strsep(&str, ",");
19
20 if (str) {
21 @@ -434,6 +434,9 @@ static int block2mtd_setup2(const char *
22 if (token[2] && (strlen(token[2]) + 1 > 80))
23 pr_err("mtd device name too long\n");
24
25 + if (token[3] && kstrtoul(token[3], 0, &timeout))
26 + pr_err("invalid timeout\n");
27 +
28 add_device(name, erase_size, token[2], timeout);
29
30 return 0;
31 @@ -468,7 +471,7 @@ static int block2mtd_setup(const char *v
32
33
34 module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
35 -MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>]]\"");
36 +MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>[,<timeout>]]]\"");
37
38 static int __init block2mtd_init(void)
39 {