aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_speedtest.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_speedtest.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_speedtest.c')
-rw-r--r--drivers/mtd/tests/mtd_speedtest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c
index ecb287847505..4d2ed5c0807d 100644
--- a/drivers/mtd/tests/mtd_speedtest.c
+++ b/drivers/mtd/tests/mtd_speedtest.c
@@ -139,7 +139,7 @@ static int erase_whole_device(void)
139 139
140static int write_eraseblock(int ebnum) 140static int write_eraseblock(int ebnum)
141{ 141{
142 size_t written = 0; 142 size_t written;
143 int err = 0; 143 int err = 0;
144 loff_t addr = ebnum * mtd->erasesize; 144 loff_t addr = ebnum * mtd->erasesize;
145 145
@@ -155,7 +155,7 @@ static int write_eraseblock(int ebnum)
155 155
156static int write_eraseblock_by_page(int ebnum) 156static int write_eraseblock_by_page(int ebnum)
157{ 157{
158 size_t written = 0; 158 size_t written;
159 int i, err = 0; 159 int i, err = 0;
160 loff_t addr = ebnum * mtd->erasesize; 160 loff_t addr = ebnum * mtd->erasesize;
161 void *buf = iobuf; 161 void *buf = iobuf;
@@ -178,7 +178,7 @@ static int write_eraseblock_by_page(int ebnum)
178 178
179static int write_eraseblock_by_2pages(int ebnum) 179static int write_eraseblock_by_2pages(int ebnum)
180{ 180{
181 size_t written = 0, sz = pgsize * 2; 181 size_t written, sz = pgsize * 2;
182 int i, n = pgcnt / 2, err = 0; 182 int i, n = pgcnt / 2, err = 0;
183 loff_t addr = ebnum * mtd->erasesize; 183 loff_t addr = ebnum * mtd->erasesize;
184 void *buf = iobuf; 184 void *buf = iobuf;
@@ -210,7 +210,7 @@ static int write_eraseblock_by_2pages(int ebnum)
210 210
211static int read_eraseblock(int ebnum) 211static int read_eraseblock(int ebnum)
212{ 212{
213 size_t read = 0; 213 size_t read;
214 int err = 0; 214 int err = 0;
215 loff_t addr = ebnum * mtd->erasesize; 215 loff_t addr = ebnum * mtd->erasesize;
216 216
@@ -229,7 +229,7 @@ static int read_eraseblock(int ebnum)
229 229
230static int read_eraseblock_by_page(int ebnum) 230static int read_eraseblock_by_page(int ebnum)
231{ 231{
232 size_t read = 0; 232 size_t read;
233 int i, err = 0; 233 int i, err = 0;
234 loff_t addr = ebnum * mtd->erasesize; 234 loff_t addr = ebnum * mtd->erasesize;
235 void *buf = iobuf; 235 void *buf = iobuf;
@@ -255,7 +255,7 @@ static int read_eraseblock_by_page(int ebnum)
255 255
256static int read_eraseblock_by_2pages(int ebnum) 256static int read_eraseblock_by_2pages(int ebnum)
257{ 257{
258 size_t read = 0, sz = pgsize * 2; 258 size_t read, sz = pgsize * 2;
259 int i, n = pgcnt / 2, err = 0; 259 int i, n = pgcnt / 2, err = 0;
260 loff_t addr = ebnum * mtd->erasesize; 260 loff_t addr = ebnum * mtd->erasesize;
261 void *buf = iobuf; 261 void *buf = iobuf;