Guest User

Untitled

a guest
Oct 5th, 2018
332
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
  2. index 2e236ef60e04..d7a902afc9a7 100644
  3. --- a/drivers/mtd/maps/physmap-core.c
  4. +++ b/drivers/mtd/maps/physmap-core.c
  5. @@ -69,8 +69,6 @@ static int physmap_flash_remove(struct platform_device *dev)
  6. if (!info)
  7. return 0;
  8.  
  9. - physmap_data = dev_get_platdata(&dev->dev);
  10. -
  11. if (info->cmtd) {
  12. err = mtd_device_unregister(info->cmtd);
  13. if (err)
  14. @@ -80,12 +78,12 @@ static int physmap_flash_remove(struct platform_device *dev)
  15. mtd_concat_destroy(info->cmtd);
  16. }
  17.  
  18. - for (i = 0; i < info->nmaps; i++) {
  19. - if (!info->mtds[i])
  20. + for (i = 0; i < info->nmaps; i++)
  21. + if (info->mtds[i])
  22. map_destroy(info->mtds[i]);
  23. - }
  24.  
  25. - if (physmap_data->exit)
  26. + physmap_data = dev_get_platdata(&dev->dev);
  27. + if (physmap_data && physmap_data->exit)
  28. physmap_data->exit(dev);
  29.  
  30. return 0;
  31. @@ -456,18 +454,18 @@ static int physmap_flash_probe(struct platform_device *dev)
  32. info->maps = devm_kzalloc(&dev->dev,
  33. sizeof(*info->maps) * info->nmaps,
  34. GFP_KERNEL);
  35. - if (info->maps)
  36. + if (!info->maps)
  37. return -ENOMEM;
  38.  
  39. info->mtds = devm_kzalloc(&dev->dev,
  40. sizeof(*info->mtds) * info->nmaps,
  41. GFP_KERNEL);
  42. - if (info->mtds)
  43. + if (!info->mtds)
  44. return -ENOMEM;
  45.  
  46. platform_set_drvdata(dev, info);
  47.  
  48. - info->gpios = devm_gpiod_get_array_optional(&dev->dev, "addr-gpios",
  49. + info->gpios = devm_gpiod_get_array_optional(&dev->dev, "addr",
  50. GPIOD_OUT_LOW);
  51. if (IS_ERR(info->gpios))
  52. return PTR_ERR(info->gpios);
  53. @@ -480,14 +478,6 @@ static int physmap_flash_probe(struct platform_device *dev)
  54. err = physmap_flash_of_init(dev);
  55. if (err)
  56. err = physmap_flash_pdata_init(dev);
  57. -
  58. - if (err)
  59. - return err;
  60. -
  61. - err = physmap_flash_of_init(dev);
  62. - if (err)
  63. - err = physmap_flash_pdata_init(dev);
  64. -
  65. if (err)
  66. return err;
  67.  
  68. @@ -509,7 +499,6 @@ static int physmap_flash_probe(struct platform_device *dev)
  69. if (!info->maps[i].phys)
  70. info->maps[i].phys = res->start;
  71.  
  72. - info->maps[i].size = resource_size(res);
  73. info->win_order = get_bitmask_order(resource_size(res)) - 1;
  74. info->maps[i].size = BIT(info->win_order +
  75. (info->gpios ?
RAW Paste Data