Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360378
b: refs/heads/master
c: 221b1bd
h: refs/heads/master
v: v3
  • Loading branch information
Al Cooper authored and Artem Bityutskiy committed Feb 13, 2013
1 parent c05a861 commit b5fd170
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb82038f97f93c5f0ff274fb98a9fff741dc2f5e
refs/heads/master: 221b1bd3d409b14e8764d8f40994b71ae6887d18
25 changes: 11 additions & 14 deletions trunk/drivers/mtd/tests/mtd_torturetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static inline int write_pattern(int ebnum, void *buf)
static int __init tort_init(void)
{
int err = 0, i, infinite = !cycles_count;
int bad_ebs[ebcnt];
int *bad_ebs;

printk(KERN_INFO "\n");
printk(KERN_INFO "=================================================\n");
Expand Down Expand Up @@ -250,28 +250,24 @@ static int __init tort_init(void)

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

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

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

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

bad_ebs = kcalloc(ebcnt, sizeof(*bad_ebs), GFP_KERNEL);
if (!bad_ebs)
goto out_check_buf;

err = 0;

Expand All @@ -290,7 +286,6 @@ static int __init tort_init(void)
/*
* Check if there is a bad eraseblock among those we are going to test.
*/
memset(&bad_ebs[0], 0, sizeof(int) * ebcnt);
if (mtd_can_have_bb(mtd)) {
for (i = eb; i < eb + ebcnt; i++) {
err = mtd_block_isbad(mtd, (loff_t)i * mtd->erasesize);
Expand Down Expand Up @@ -394,6 +389,8 @@ static int __init tort_init(void)

pr_info("finished after %u erase cycles\n",
erase_cycles);
kfree(bad_ebs);
out_check_buf:
kfree(check_buf);
out_patt_FF:
kfree(patt_FF);
Expand Down

0 comments on commit b5fd170

Please sign in to comment.