aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_torturetest.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-29 08:16:28 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:25:56 -0500
commit30fa98480b782999248ce8290136aa58f22536cf (patch)
tree39136ed3fae074abc0178c0b78a2e242700b4cc0 /drivers/mtd/tests/mtd_torturetest.c
parent9cf075f8656524abc44ad3ff2ec3834fe76f186f (diff)
mtd: remove extra retlen assignment
MTD functions always assign the 'retlen' argument to 0 at the very beginning - the callers do not have to do this. I used the following semantic patch to find these places: @@ identifier retlen; expression a, b, c, d, e; constant C; type T; @@ ( - retlen = C; | T -retlen = C + retlen ; ) ... when != retlen when exists ( mtd_read(a, b, c, &retlen, d) | mtd_write(a, b, c, &retlen, d) | mtd_panic_write(a, b, c, &retlen, d) | mtd_point(a, b, c, &retlen, d, e) | mtd_read_fact_prot_reg(a, b, c, &retlen, d) | mtd_write_user_prot_reg(a, b, c, &retlen, d) | mtd_read_user_prot_reg(a, b, c, &retlen, d) | mtd_writev(a, b, c, d, &retlen) ) I ran it twice, because there were cases of double zero assigments in mtd tests. Then I went through the patch to verify that spatch did not find any false positives. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/tests/mtd_torturetest.c')
-rw-r--r--drivers/mtd/tests/mtd_torturetest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index 30c4ed9855ec..557105f2ead3 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -127,7 +127,7 @@ static inline int erase_eraseblock(int ebnum)
127static inline int check_eraseblock(int ebnum, unsigned char *buf) 127static inline int check_eraseblock(int ebnum, unsigned char *buf)
128{ 128{
129 int err, retries = 0; 129 int err, retries = 0;
130 size_t read = 0; 130 size_t read;
131 loff_t addr = ebnum * mtd->erasesize; 131 loff_t addr = ebnum * mtd->erasesize;
132 size_t len = mtd->erasesize; 132 size_t len = mtd->erasesize;
133 133
@@ -181,7 +181,7 @@ retry:
181static inline int write_pattern(int ebnum, void *buf) 181static inline int write_pattern(int ebnum, void *buf)
182{ 182{
183 int err; 183 int err;
184 size_t written = 0; 184 size_t written;
185 loff_t addr = ebnum * mtd->erasesize; 185 loff_t addr = ebnum * mtd->erasesize;
186 size_t len = mtd->erasesize; 186 size_t len = mtd->erasesize;
187 187