Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7406060e authored by Wolfram Sang's avatar Wolfram Sang Committed by Artem Bityutskiy
Browse files

mtd: tests: don't use mtd0 as a default



mtd tests may erase the mtd device, so force the user to specify which
mtd device to test by using the module parameter. Disable the default
(using mtd0) since this may destroy a vital part of the flash if the
module is inserted accidently or carelessly.

Reported-by: default avatarRoland Kletzing <devzero@web.de>
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@intel.com>
parent 6be55f79
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@

#define PRINT_PREF KERN_INFO "mtd_oobtest: "

static int dev;
static int dev = -EINVAL;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");

@@ -366,6 +366,13 @@ static int __init mtd_oobtest_init(void)

	printk(KERN_INFO "\n");
	printk(KERN_INFO "=================================================\n");

	if (dev < 0) {
		printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
		printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n");
		return -EINVAL;
	}

	printk(PRINT_PREF "MTD device: %d\n", dev);

	mtd = get_mtd_device(NULL, dev);
+8 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@

#define PRINT_PREF KERN_INFO "mtd_pagetest: "

static int dev;
static int dev = -EINVAL;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");

@@ -504,6 +504,13 @@ static int __init mtd_pagetest_init(void)

	printk(KERN_INFO "\n");
	printk(KERN_INFO "=================================================\n");

	if (dev < 0) {
		printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
		printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n");
		return -EINVAL;
	}

	printk(PRINT_PREF "MTD device: %d\n", dev);

	mtd = get_mtd_device(NULL, dev);
+7 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@

#define PRINT_PREF KERN_INFO "mtd_readtest: "

static int dev;
static int dev = -EINVAL;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");

@@ -170,6 +170,12 @@ static int __init mtd_readtest_init(void)

	printk(KERN_INFO "\n");
	printk(KERN_INFO "=================================================\n");

	if (dev < 0) {
		printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
		return -EINVAL;
	}

	printk(PRINT_PREF "MTD device: %d\n", dev);

	mtd = get_mtd_device(NULL, dev);
+8 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@

#define PRINT_PREF KERN_INFO "mtd_speedtest: "

static int dev;
static int dev = -EINVAL;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");

@@ -361,6 +361,13 @@ static int __init mtd_speedtest_init(void)

	printk(KERN_INFO "\n");
	printk(KERN_INFO "=================================================\n");

	if (dev < 0) {
		printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
		printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n");
		return -EINVAL;
	}

	if (count)
		printk(PRINT_PREF "MTD device: %d    count: %d\n", dev, count);
	else
+8 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@

#define PRINT_PREF KERN_INFO "mtd_stresstest: "

static int dev;
static int dev = -EINVAL;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");

@@ -250,6 +250,13 @@ static int __init mtd_stresstest_init(void)

	printk(KERN_INFO "\n");
	printk(KERN_INFO "=================================================\n");

	if (dev < 0) {
		printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
		printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n");
		return -EINVAL;
	}

	printk(PRINT_PREF "MTD device: %d\n", dev);

	mtd = get_mtd_device(NULL, dev);
Loading