mtd: remove dead non-char logic

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Oct 15 23:59:03 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=5e47212831ac565993d21ebd36216d98f2b58f30
Commit:     5e47212831ac565993d21ebd36216d98f2b58f30
Parent:     f7f0d358f5f2f1133b5a14337028ddab848cd74e
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Mon Jul 21 19:06:47 2014 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Aug 19 11:53:08 2014 -0700

    mtd: remove dead non-char logic
    
    MTD used to allow compiling out character device support. This was
    dropped in the following commit, but some of the accompanying logic was
    never dropped:
    
      commit 660685d9d1b4730f0b5ca97fa95f272f99c63bce
      Author: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
      Date:   Thu Mar 14 13:27:40 2013 +0200
    
          mtd: merge mtdchar module with mtdcore
    
    The weird logic was flagged by Coverity.
    
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
    Cc: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
 drivers/mtd/mtdcore.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index c101517..4c61187 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -105,12 +105,11 @@ static LIST_HEAD(mtd_notifiers);
  */
 static void mtd_release(struct device *dev)
 {
-	struct mtd_info __maybe_unused *mtd = dev_get_drvdata(dev);
+	struct mtd_info *mtd = dev_get_drvdata(dev);
 	dev_t index = MTD_DEVT(mtd->index);
 
-	/* remove /dev/mtdXro node if needed */
-	if (index)
-		device_destroy(&mtd_class, index + 1);
+	/* remove /dev/mtdXro node */
+	device_destroy(&mtd_class, index + 1);
 }
 
 static int mtd_cls_suspend(struct device *dev, pm_message_t state)
@@ -442,10 +441,8 @@ int add_mtd_device(struct mtd_info *mtd)
 	if (device_register(&mtd->dev) != 0)
 		goto fail_added;
 
-	if (MTD_DEVT(i))
-		device_create(&mtd_class, mtd->dev.parent,
-			      MTD_DEVT(i) + 1,
-			      NULL, "mtd%dro", i);
+	device_create(&mtd_class, mtd->dev.parent, MTD_DEVT(i) + 1, NULL,
+		      "mtd%dro", i);
 
 	pr_debug("mtd: Giving out device %d to %s\n", i, mtd->name);
 	/* No need to get a refcount on the module containing



More information about the linux-mtd-cvs mailing list