065-v4.13-0004-mtd-partitions-remove-sysfs-files-when-deleting-all-.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From c5ceaba74083daf619bdb34d4871e297a177eebf Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  3. Date: Wed, 21 Jun 2017 08:26:43 +0200
  4. Subject: [PATCH] mtd: partitions: remove sysfs files when deleting all
  5. master's partitions
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. When support for sysfs "offset" file was added it missed to update the
  10. del_mtd_partitions function. It deletes partitions just like
  11. mtd_del_partition does so both should also take care of removing sysfs
  12. files.
  13. This change moves sysfs_remove_files call to the shared function to fix
  14. this issue.
  15. Fixes: a62c24d755291 ("mtd: part: Add sysfs variable for offset of partition")
  16. Cc: Dan Ehrenberg <[email protected]>
  17. Signed-off-by: Rafał Miłecki <[email protected]>
  18. Signed-off-by: Brian Norris <[email protected]>
  19. ---
  20. drivers/mtd/mtdpart.c | 4 ++--
  21. 1 file changed, 2 insertions(+), 2 deletions(-)
  22. --- a/drivers/mtd/mtdpart.c
  23. +++ b/drivers/mtd/mtdpart.c
  24. @@ -660,6 +660,8 @@ static int __mtd_del_partition(struct mt
  25. {
  26. int err;
  27. + sysfs_remove_files(&priv->mtd.dev.kobj, mtd_partition_attrs);
  28. +
  29. err = del_mtd_device(&priv->mtd);
  30. if (err)
  31. return err;
  32. @@ -700,8 +702,6 @@ int mtd_del_partition(struct mtd_info *m
  33. list_for_each_entry_safe(slave, next, &mtd_partitions, list)
  34. if ((slave->master == master) &&
  35. (slave->mtd.index == partno)) {
  36. - sysfs_remove_files(&slave->mtd.dev.kobj,
  37. - mtd_partition_attrs);
  38. ret = __mtd_del_partition(slave);
  39. break;
  40. }