441-block2mtd_probe.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Subject: block2mtd
  3. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  4. ---
  5. drivers/mtd/devices/block2mtd.c | 9 ++++++---
  6. 1 file changed, 6 insertions(+), 3 deletions(-)
  7. --- a/drivers/mtd/devices/block2mtd.c
  8. +++ b/drivers/mtd/devices/block2mtd.c
  9. @@ -392,7 +392,7 @@ static int block2mtd_setup2(const char *
  10. /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */
  11. char buf[80 + 12 + 80 + 8];
  12. char *str = buf;
  13. - char *token[3];
  14. + char *token[4];
  15. char *name;
  16. size_t erase_size = PAGE_SIZE;
  17. unsigned long timeout = MTD_DEFAULT_TIMEOUT;
  18. @@ -406,7 +406,7 @@ static int block2mtd_setup2(const char *
  19. strcpy(str, val);
  20. kill_final_newline(str);
  21. - for (i = 0; i < 3; i++)
  22. + for (i = 0; i < 4; i++)
  23. token[i] = strsep(&str, ",");
  24. if (str) {
  25. @@ -435,6 +435,9 @@ static int block2mtd_setup2(const char *
  26. if (token[2] && (strlen(token[2]) + 1 > 80))
  27. pr_err("mtd device name too long\n");
  28. + if (token[3] && kstrtoul(token[3], 0, &timeout))
  29. + pr_err("invalid timeout\n");
  30. +
  31. add_device(name, erase_size, token[2], timeout);
  32. return 0;
  33. @@ -469,7 +472,7 @@ static int block2mtd_setup(const char *v
  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. static int __init block2mtd_init(void)
  38. {