diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2011-10-30 00:11:53 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@intel.com> | 2011-10-30 13:31:04 +0100 |
commit | 7406060e292c389fe6f38bd23493de9b57f2f4fc (patch) | |
tree | 1b88dfc908c3be01a86d74685a4329c69d2f9348 /drivers/mtd/tests/mtd_oobtest.c | |
parent | mtd: clean up usage of MTD_DOCPROBE_ADDRESS (diff) | |
download | linux-7406060e292c389fe6f38bd23493de9b57f2f4fc.tar.xz linux-7406060e292c389fe6f38bd23493de9b57f2f4fc.zip |
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 <devzero@web.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
Diffstat (limited to 'drivers/mtd/tests/mtd_oobtest.c')
-rw-r--r-- | drivers/mtd/tests/mtd_oobtest.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c index 6bcff42296a9..933f7e5f32d3 100644 --- a/drivers/mtd/tests/mtd_oobtest.c +++ b/drivers/mtd/tests/mtd_oobtest.c @@ -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); |