441-block2mtd_probe.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. - for (i = 0; i < 3; i++)
  16. + for (i = 0; i < 4; i++)
  17. token[i] = strsep(&str, ",");
  18. if (str) {
  19. @@ -434,6 +434,9 @@ static int block2mtd_setup2(const char *
  20. if (token[2] && (strlen(token[2]) + 1 > 80))
  21. pr_err("mtd device name too long\n");
  22. + if (token[3] && kstrtoul(token[3], 0, &timeout))
  23. + pr_err("invalid timeout\n");
  24. +
  25. add_device(name, erase_size, token[2], timeout);
  26. return 0;
  27. @@ -468,7 +471,7 @@ static int block2mtd_setup(const char *v
  28. module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
  29. -MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>]]\"");
  30. +MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>[,<timeout>]]]\"");
  31. static int __init block2mtd_init(void)
  32. {