diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-29 08:16:28 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:56 -0500 |
commit | 30fa98480b782999248ce8290136aa58f22536cf (patch) | |
tree | 39136ed3fae074abc0178c0b78a2e242700b4cc0 /drivers/mtd/tests/mtd_stresstest.c | |
parent | 9cf075f8656524abc44ad3ff2ec3834fe76f186f (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_stresstest.c')
-rw-r--r-- | drivers/mtd/tests/mtd_stresstest.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c index 4789c0ee3e9a..399aa2bf220d 100644 --- a/drivers/mtd/tests/mtd_stresstest.c +++ b/drivers/mtd/tests/mtd_stresstest.c | |||
@@ -140,7 +140,7 @@ static int is_block_bad(int ebnum) | |||
140 | 140 | ||
141 | static int do_read(void) | 141 | static int do_read(void) |
142 | { | 142 | { |
143 | size_t read = 0; | 143 | size_t read; |
144 | int eb = rand_eb(); | 144 | int eb = rand_eb(); |
145 | int offs = rand_offs(); | 145 | int offs = rand_offs(); |
146 | int len = rand_len(offs), err; | 146 | int len = rand_len(offs), err; |
@@ -169,7 +169,7 @@ static int do_read(void) | |||
169 | static int do_write(void) | 169 | static int do_write(void) |
170 | { | 170 | { |
171 | int eb = rand_eb(), offs, err, len; | 171 | int eb = rand_eb(), offs, err, len; |
172 | size_t written = 0; | 172 | size_t written; |
173 | loff_t addr; | 173 | loff_t addr; |
174 | 174 | ||
175 | offs = offsets[eb]; | 175 | offs = offsets[eb]; |