From 7406060e292c389fe6f38bd23493de9b57f2f4fc Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Sun, 30 Oct 2011 00:11:53 +0200 Subject: 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: Roland Kletzing Signed-off-by: Wolfram Sang Signed-off-by: Artem Bityutskiy --- drivers/mtd/tests/mtd_speedtest.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/mtd/tests/mtd_speedtest.c') diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c index 79d53ee62295..493b367bdd35 100644 --- a/drivers/mtd/tests/mtd_speedtest.c +++ b/drivers/mtd/tests/mtd_speedtest.c @@ -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 -- cgit v1.2.3