Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@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@gmail.com>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

+5 -8
+5 -8
drivers/mtd/mtdcore.c
··· 105 105 */ 106 106 static void mtd_release(struct device *dev) 107 107 { 108 - struct mtd_info __maybe_unused *mtd = dev_get_drvdata(dev); 108 + struct mtd_info *mtd = dev_get_drvdata(dev); 109 109 dev_t index = MTD_DEVT(mtd->index); 110 110 111 - /* remove /dev/mtdXro node if needed */ 112 - if (index) 113 - device_destroy(&mtd_class, index + 1); 111 + /* remove /dev/mtdXro node */ 112 + device_destroy(&mtd_class, index + 1); 114 113 } 115 114 116 115 static int mtd_cls_suspend(struct device *dev, pm_message_t state) ··· 441 442 if (device_register(&mtd->dev) != 0) 442 443 goto fail_added; 443 444 444 - if (MTD_DEVT(i)) 445 - device_create(&mtd_class, mtd->dev.parent, 446 - MTD_DEVT(i) + 1, 447 - NULL, "mtd%dro", i); 445 + device_create(&mtd_class, mtd->dev.parent, MTD_DEVT(i) + 1, NULL, 446 + "mtd%dro", i); 448 447 449 448 pr_debug("mtd: Giving out device %d to %s\n", i, mtd->name); 450 449 /* No need to get a refcount on the module containing