summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2013-05-02 17:18:51 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-05 15:49:22 -0400
commit33777e6676ca60652bd48c7867641fb779106909 (patch)
tree71cb59715664940f1f7ba53f4cc7463680efe405
parent59bff7fb7a0b461320744a9a9b7bf75b8eeddea8 (diff)
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: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c12
-rw-r--r--drivers/mtd/tests/mtd_pagetest.c20
-rw-r--r--drivers/mtd/tests/mtd_readtest.c12
-rw-r--r--drivers/mtd/tests/mtd_speedtest.c8
-rw-r--r--drivers/mtd/tests/mtd_stresstest.c8
-rw-r--r--drivers/mtd/tests/mtd_subpagetest.c12
6 files changed, 18 insertions, 54 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index 3e24b379ffa4..ab81e9a5947e 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -320,10 +320,8 @@ static int scan_for_bad_eraseblocks(void)
320 int i, bad = 0; 320 int i, bad = 0;
321 321
322 bbt = kmalloc(ebcnt, GFP_KERNEL); 322 bbt = kmalloc(ebcnt, GFP_KERNEL);
323 if (!bbt) { 323 if (!bbt)
324 pr_err("error: cannot allocate memory\n");
325 return -ENOMEM; 324 return -ENOMEM;
326 }
327 325
328 pr_info("scanning for bad eraseblocks\n"); 326 pr_info("scanning for bad eraseblocks\n");
329 for (i = 0; i < ebcnt; ++i) { 327 for (i = 0; i < ebcnt; ++i) {
@@ -380,15 +378,11 @@ static int __init mtd_oobtest_init(void)
380 378
381 err = -ENOMEM; 379 err = -ENOMEM;
382 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL); 380 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL);
383 if (!readbuf) { 381 if (!readbuf)
384 pr_err("error: cannot allocate memory\n");
385 goto out; 382 goto out;
386 }
387 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); 383 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL);
388 if (!writebuf) { 384 if (!writebuf)
389 pr_err("error: cannot allocate memory\n");
390 goto out; 385 goto out;
391 }
392 386
393 err = scan_for_bad_eraseblocks(); 387 err = scan_for_bad_eraseblocks();
394 if (err) 388 if (err)
diff --git a/drivers/mtd/tests/mtd_pagetest.c b/drivers/mtd/tests/mtd_pagetest.c
index 0c1140b6c286..acd991f4bf94 100644
--- a/drivers/mtd/tests/mtd_pagetest.c
+++ b/drivers/mtd/tests/mtd_pagetest.c
@@ -191,10 +191,8 @@ static int crosstest(void)
191 191
192 pr_info("crosstest\n"); 192 pr_info("crosstest\n");
193 pp1 = kmalloc(pgsize * 4, GFP_KERNEL); 193 pp1 = kmalloc(pgsize * 4, GFP_KERNEL);
194 if (!pp1) { 194 if (!pp1)
195 pr_err("error: cannot allocate memory\n");
196 return -ENOMEM; 195 return -ENOMEM;
197 }
198 pp2 = pp1 + pgsize; 196 pp2 = pp1 + pgsize;
199 pp3 = pp2 + pgsize; 197 pp3 = pp2 + pgsize;
200 pp4 = pp3 + pgsize; 198 pp4 = pp3 + pgsize;
@@ -456,10 +454,8 @@ static int scan_for_bad_eraseblocks(void)
456 int i, bad = 0; 454 int i, bad = 0;
457 455
458 bbt = kzalloc(ebcnt, GFP_KERNEL); 456 bbt = kzalloc(ebcnt, GFP_KERNEL);
459 if (!bbt) { 457 if (!bbt)
460 pr_err("error: cannot allocate memory\n");
461 return -ENOMEM; 458 return -ENOMEM;
462 }
463 459
464 pr_info("scanning for bad eraseblocks\n"); 460 pr_info("scanning for bad eraseblocks\n");
465 for (i = 0; i < ebcnt; ++i) { 461 for (i = 0; i < ebcnt; ++i) {
@@ -516,20 +512,14 @@ static int __init mtd_pagetest_init(void)
516 err = -ENOMEM; 512 err = -ENOMEM;
517 bufsize = pgsize * 2; 513 bufsize = pgsize * 2;
518 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); 514 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL);
519 if (!writebuf) { 515 if (!writebuf)
520 pr_err("error: cannot allocate memory\n");
521 goto out; 516 goto out;
522 }
523 twopages = kmalloc(bufsize, GFP_KERNEL); 517 twopages = kmalloc(bufsize, GFP_KERNEL);
524 if (!twopages) { 518 if (!twopages)
525 pr_err("error: cannot allocate memory\n");
526 goto out; 519 goto out;
527 }
528 boundary = kmalloc(bufsize, GFP_KERNEL); 520 boundary = kmalloc(bufsize, GFP_KERNEL);
529 if (!boundary) { 521 if (!boundary)
530 pr_err("error: cannot allocate memory\n");
531 goto out; 522 goto out;
532 }
533 523
534 err = scan_for_bad_eraseblocks(); 524 err = scan_for_bad_eraseblocks();
535 if (err) 525 if (err)
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
index 266de04b6d29..2cdd0c47cac1 100644
--- a/drivers/mtd/tests/mtd_readtest.c
+++ b/drivers/mtd/tests/mtd_readtest.c
@@ -143,10 +143,8 @@ static int scan_for_bad_eraseblocks(void)
143 int i, bad = 0; 143 int i, bad = 0;
144 144
145 bbt = kzalloc(ebcnt, GFP_KERNEL); 145 bbt = kzalloc(ebcnt, GFP_KERNEL);
146 if (!bbt) { 146 if (!bbt)
147 pr_err("error: cannot allocate memory\n");
148 return -ENOMEM; 147 return -ENOMEM;
149 }
150 148
151 if (!mtd_can_have_bb(mtd)) 149 if (!mtd_can_have_bb(mtd))
152 return 0; 150 return 0;
@@ -204,15 +202,11 @@ static int __init mtd_readtest_init(void)
204 202
205 err = -ENOMEM; 203 err = -ENOMEM;
206 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); 204 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
207 if (!iobuf) { 205 if (!iobuf)
208 pr_err("error: cannot allocate memory\n");
209 goto out; 206 goto out;
210 }
211 iobuf1 = kmalloc(mtd->erasesize, GFP_KERNEL); 207 iobuf1 = kmalloc(mtd->erasesize, GFP_KERNEL);
212 if (!iobuf1) { 208 if (!iobuf1)
213 pr_err("error: cannot allocate memory\n");
214 goto out; 209 goto out;
215 }
216 210
217 err = scan_for_bad_eraseblocks(); 211 err = scan_for_bad_eraseblocks();
218 if (err) 212 if (err)
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c
index a6ce9c1fa6c5..20b63d1ad494 100644
--- a/drivers/mtd/tests/mtd_speedtest.c
+++ b/drivers/mtd/tests/mtd_speedtest.c
@@ -313,10 +313,8 @@ static int scan_for_bad_eraseblocks(void)
313 int i, bad = 0; 313 int i, bad = 0;
314 314
315 bbt = kzalloc(ebcnt, GFP_KERNEL); 315 bbt = kzalloc(ebcnt, GFP_KERNEL);
316 if (!bbt) { 316 if (!bbt)
317 pr_err("error: cannot allocate memory\n");
318 return -ENOMEM; 317 return -ENOMEM;
319 }
320 318
321 if (!mtd_can_have_bb(mtd)) 319 if (!mtd_can_have_bb(mtd))
322 goto out; 320 goto out;
@@ -384,10 +382,8 @@ static int __init mtd_speedtest_init(void)
384 382
385 err = -ENOMEM; 383 err = -ENOMEM;
386 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); 384 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
387 if (!iobuf) { 385 if (!iobuf)
388 pr_err("error: cannot allocate memory\n");
389 goto out; 386 goto out;
390 }
391 387
392 prandom_bytes(iobuf, mtd->erasesize); 388 prandom_bytes(iobuf, mtd->erasesize);
393 389
diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c
index 787f539d16ca..3a95e61b535d 100644
--- a/drivers/mtd/tests/mtd_stresstest.c
+++ b/drivers/mtd/tests/mtd_stresstest.c
@@ -202,10 +202,8 @@ static int scan_for_bad_eraseblocks(void)
202 int i, bad = 0; 202 int i, bad = 0;
203 203
204 bbt = kzalloc(ebcnt, GFP_KERNEL); 204 bbt = kzalloc(ebcnt, GFP_KERNEL);
205 if (!bbt) { 205 if (!bbt)
206 pr_err("error: cannot allocate memory\n");
207 return -ENOMEM; 206 return -ENOMEM;
208 }
209 207
210 if (!mtd_can_have_bb(mtd)) 208 if (!mtd_can_have_bb(mtd))
211 return 0; 209 return 0;
@@ -276,10 +274,8 @@ static int __init mtd_stresstest_init(void)
276 readbuf = vmalloc(bufsize); 274 readbuf = vmalloc(bufsize);
277 writebuf = vmalloc(bufsize); 275 writebuf = vmalloc(bufsize);
278 offsets = kmalloc(ebcnt * sizeof(int), GFP_KERNEL); 276 offsets = kmalloc(ebcnt * sizeof(int), GFP_KERNEL);
279 if (!readbuf || !writebuf || !offsets) { 277 if (!readbuf || !writebuf || !offsets)
280 pr_err("error: cannot allocate memory\n");
281 goto out; 278 goto out;
282 }
283 for (i = 0; i < ebcnt; i++) 279 for (i = 0; i < ebcnt; i++)
284 offsets[i] = mtd->erasesize; 280 offsets[i] = mtd->erasesize;
285 prandom_bytes(writebuf, bufsize); 281 prandom_bytes(writebuf, bufsize);
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c
index aade56f27945..e41a04f5caab 100644
--- a/drivers/mtd/tests/mtd_subpagetest.c
+++ b/drivers/mtd/tests/mtd_subpagetest.c
@@ -333,10 +333,8 @@ static int scan_for_bad_eraseblocks(void)
333 int i, bad = 0; 333 int i, bad = 0;
334 334
335 bbt = kzalloc(ebcnt, GFP_KERNEL); 335 bbt = kzalloc(ebcnt, GFP_KERNEL);
336 if (!bbt) { 336 if (!bbt)
337 pr_err("error: cannot allocate memory\n");
338 return -ENOMEM; 337 return -ENOMEM;
339 }
340 338
341 pr_info("scanning for bad eraseblocks\n"); 339 pr_info("scanning for bad eraseblocks\n");
342 for (i = 0; i < ebcnt; ++i) { 340 for (i = 0; i < ebcnt; ++i) {
@@ -393,15 +391,11 @@ static int __init mtd_subpagetest_init(void)
393 err = -ENOMEM; 391 err = -ENOMEM;
394 bufsize = subpgsize * 32; 392 bufsize = subpgsize * 32;
395 writebuf = kmalloc(bufsize, GFP_KERNEL); 393 writebuf = kmalloc(bufsize, GFP_KERNEL);
396 if (!writebuf) { 394 if (!writebuf)
397 pr_info("error: cannot allocate memory\n");
398 goto out; 395 goto out;
399 }
400 readbuf = kmalloc(bufsize, GFP_KERNEL); 396 readbuf = kmalloc(bufsize, GFP_KERNEL);
401 if (!readbuf) { 397 if (!readbuf)
402 pr_info("error: cannot allocate memory\n");
403 goto out; 398 goto out;
404 }
405 399
406 err = scan_for_bad_eraseblocks(); 400 err = scan_for_bad_eraseblocks();
407 if (err) 401 if (err)