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

Commit 33777e66 authored by Brian Norris's avatar Brian Norris Committed by David Woodhouse
Browse files

mtd: tests: don't print error messages when out-of-memory



These strings are now unnecessary and discouraged in the kernel. The
kernel will have plenty of big scary messages if kmalloc fails. These
now only serve to bloat the module.

Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 59bff7fb
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -320,10 +320,8 @@ static int scan_for_bad_eraseblocks(void)
	int i, bad = 0;

	bbt = kmalloc(ebcnt, GFP_KERNEL);
	if (!bbt) {
		pr_err("error: cannot allocate memory\n");
	if (!bbt)
		return -ENOMEM;
	}

	pr_info("scanning for bad eraseblocks\n");
	for (i = 0; i < ebcnt; ++i) {
@@ -380,15 +378,11 @@ static int __init mtd_oobtest_init(void)

	err = -ENOMEM;
	readbuf = kmalloc(mtd->erasesize, GFP_KERNEL);
	if (!readbuf) {
		pr_err("error: cannot allocate memory\n");
	if (!readbuf)
		goto out;
	}
	writebuf = kmalloc(mtd->erasesize, GFP_KERNEL);
	if (!writebuf) {
		pr_err("error: cannot allocate memory\n");
	if (!writebuf)
		goto out;
	}

	err = scan_for_bad_eraseblocks();
	if (err)
+5 −15
Original line number Diff line number Diff line
@@ -191,10 +191,8 @@ static int crosstest(void)

	pr_info("crosstest\n");
	pp1 = kmalloc(pgsize * 4, GFP_KERNEL);
	if (!pp1) {
		pr_err("error: cannot allocate memory\n");
	if (!pp1)
		return -ENOMEM;
	}
	pp2 = pp1 + pgsize;
	pp3 = pp2 + pgsize;
	pp4 = pp3 + pgsize;
@@ -456,10 +454,8 @@ static int scan_for_bad_eraseblocks(void)
	int i, bad = 0;

	bbt = kzalloc(ebcnt, GFP_KERNEL);
	if (!bbt) {
		pr_err("error: cannot allocate memory\n");
	if (!bbt)
		return -ENOMEM;
	}

	pr_info("scanning for bad eraseblocks\n");
	for (i = 0; i < ebcnt; ++i) {
@@ -516,20 +512,14 @@ static int __init mtd_pagetest_init(void)
	err = -ENOMEM;
	bufsize = pgsize * 2;
	writebuf = kmalloc(mtd->erasesize, GFP_KERNEL);
	if (!writebuf) {
		pr_err("error: cannot allocate memory\n");
	if (!writebuf)
		goto out;
	}
	twopages = kmalloc(bufsize, GFP_KERNEL);
	if (!twopages) {
		pr_err("error: cannot allocate memory\n");
	if (!twopages)
		goto out;
	}
	boundary = kmalloc(bufsize, GFP_KERNEL);
	if (!boundary) {
		pr_err("error: cannot allocate memory\n");
	if (!boundary)
		goto out;
	}

	err = scan_for_bad_eraseblocks();
	if (err)
+3 −9
Original line number Diff line number Diff line
@@ -143,10 +143,8 @@ static int scan_for_bad_eraseblocks(void)
	int i, bad = 0;

	bbt = kzalloc(ebcnt, GFP_KERNEL);
	if (!bbt) {
		pr_err("error: cannot allocate memory\n");
	if (!bbt)
		return -ENOMEM;
	}

	if (!mtd_can_have_bb(mtd))
		return 0;
@@ -204,15 +202,11 @@ static int __init mtd_readtest_init(void)

	err = -ENOMEM;
	iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
	if (!iobuf) {
		pr_err("error: cannot allocate memory\n");
	if (!iobuf)
		goto out;
	}
	iobuf1 = kmalloc(mtd->erasesize, GFP_KERNEL);
	if (!iobuf1) {
		pr_err("error: cannot allocate memory\n");
	if (!iobuf1)
		goto out;
	}

	err = scan_for_bad_eraseblocks();
	if (err)
+2 −6
Original line number Diff line number Diff line
@@ -313,10 +313,8 @@ static int scan_for_bad_eraseblocks(void)
	int i, bad = 0;

	bbt = kzalloc(ebcnt, GFP_KERNEL);
	if (!bbt) {
		pr_err("error: cannot allocate memory\n");
	if (!bbt)
		return -ENOMEM;
	}

	if (!mtd_can_have_bb(mtd))
		goto out;
@@ -384,10 +382,8 @@ static int __init mtd_speedtest_init(void)

	err = -ENOMEM;
	iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
	if (!iobuf) {
		pr_err("error: cannot allocate memory\n");
	if (!iobuf)
		goto out;
	}

	prandom_bytes(iobuf, mtd->erasesize);

+2 −6
Original line number Diff line number Diff line
@@ -202,10 +202,8 @@ static int scan_for_bad_eraseblocks(void)
	int i, bad = 0;

	bbt = kzalloc(ebcnt, GFP_KERNEL);
	if (!bbt) {
		pr_err("error: cannot allocate memory\n");
	if (!bbt)
		return -ENOMEM;
	}

	if (!mtd_can_have_bb(mtd))
		return 0;
@@ -276,10 +274,8 @@ static int __init mtd_stresstest_init(void)
	readbuf = vmalloc(bufsize);
	writebuf = vmalloc(bufsize);
	offsets = kmalloc(ebcnt * sizeof(int), GFP_KERNEL);
	if (!readbuf || !writebuf || !offsets) {
		pr_err("error: cannot allocate memory\n");
	if (!readbuf || !writebuf || !offsets)
		goto out;
	}
	for (i = 0; i < ebcnt; i++)
		offsets[i] = mtd->erasesize;
	prandom_bytes(writebuf, bufsize);
Loading