[PATCH 1/2] mtd: tests: don't use mtd0 as a default
Artem Bityutskiy
dedekind1 at gmail.com
Tue Oct 25 07:34:04 EDT 2011
On Tue, 2011-10-25 at 11:09 +0200, Wolfram Sang wrote:
> 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 at web.de>
> Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
> ---
> drivers/mtd/tests/mtd_oobtest.c | 2 +-
> drivers/mtd/tests/mtd_pagetest.c | 2 +-
> drivers/mtd/tests/mtd_readtest.c | 2 +-
> drivers/mtd/tests/mtd_speedtest.c | 2 +-
> drivers/mtd/tests/mtd_stresstest.c | 2 +-
> drivers/mtd/tests/mtd_subpagetest.c | 2 +-
> drivers/mtd/tests/mtd_torturetest.c | 2 +-
> 7 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
> index dec92ae..ff77b8e 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 = -1;
> module_param(dev, int, S_IRUGO);
> MODULE_PARM_DESC(dev, "MTD device number to use");
How about adding something like:
if (dev == -1) {
printk(KERN_WARN "Please, specify the test MTD device\n");
printk(KERN_WARN "WARNING: this test destroys the test MTD device's data\n");
return -1;
}
Of course for the readtest the warning should not be printed.
--
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20111025/790c28f9/attachment.sig>
More information about the linux-mtd
mailing list