Commit 30a9b9e1 authored by Fabio Estevam's avatar Fabio Estevam Committed by Ulf Hansson

mmc: card: mmc_test: Simplify a trivial if-return sequence

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/simple_return.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 7ccddeb0
...@@ -268,8 +268,6 @@ static int mmc_test_wait_busy(struct mmc_test_card *test) ...@@ -268,8 +268,6 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
static int mmc_test_buffer_transfer(struct mmc_test_card *test, static int mmc_test_buffer_transfer(struct mmc_test_card *test,
u8 *buffer, unsigned addr, unsigned blksz, int write) u8 *buffer, unsigned addr, unsigned blksz, int write)
{ {
int ret;
struct mmc_request mrq = {0}; struct mmc_request mrq = {0};
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
struct mmc_command stop = {0}; struct mmc_command stop = {0};
...@@ -292,11 +290,7 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test, ...@@ -292,11 +290,7 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test,
if (data.error) if (data.error)
return data.error; return data.error;
ret = mmc_test_wait_busy(test); return mmc_test_wait_busy(test);
if (ret)
return ret;
return 0;
} }
static void mmc_test_free_mem(struct mmc_test_mem *mem) static void mmc_test_free_mem(struct mmc_test_mem *mem)
...@@ -994,11 +988,7 @@ static int mmc_test_basic_write(struct mmc_test_card *test) ...@@ -994,11 +988,7 @@ static int mmc_test_basic_write(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, 512); sg_init_one(&sg, test->buffer, 512);
ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1); return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_basic_read(struct mmc_test_card *test) static int mmc_test_basic_read(struct mmc_test_card *test)
...@@ -1012,44 +1002,29 @@ static int mmc_test_basic_read(struct mmc_test_card *test) ...@@ -1012,44 +1002,29 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, 512); sg_init_one(&sg, test->buffer, 512);
ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0); return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
if (ret)
return ret;
return 0;
} }
static int mmc_test_verify_write(struct mmc_test_card *test) static int mmc_test_verify_write(struct mmc_test_card *test)
{ {
int ret;
struct scatterlist sg; struct scatterlist sg;
sg_init_one(&sg, test->buffer, 512); sg_init_one(&sg, test->buffer, 512);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_verify_read(struct mmc_test_card *test) static int mmc_test_verify_read(struct mmc_test_card *test)
{ {
int ret;
struct scatterlist sg; struct scatterlist sg;
sg_init_one(&sg, test->buffer, 512); sg_init_one(&sg, test->buffer, 512);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
if (ret)
return ret;
return 0;
} }
static int mmc_test_multi_write(struct mmc_test_card *test) static int mmc_test_multi_write(struct mmc_test_card *test)
{ {
int ret;
unsigned int size; unsigned int size;
struct scatterlist sg; struct scatterlist sg;
...@@ -1066,16 +1041,11 @@ static int mmc_test_multi_write(struct mmc_test_card *test) ...@@ -1066,16 +1041,11 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, size); sg_init_one(&sg, test->buffer, size);
ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1); return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_multi_read(struct mmc_test_card *test) static int mmc_test_multi_read(struct mmc_test_card *test)
{ {
int ret;
unsigned int size; unsigned int size;
struct scatterlist sg; struct scatterlist sg;
...@@ -1092,11 +1062,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test) ...@@ -1092,11 +1062,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, size); sg_init_one(&sg, test->buffer, size);
ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0); return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
if (ret)
return ret;
return 0;
} }
static int mmc_test_pow2_write(struct mmc_test_card *test) static int mmc_test_pow2_write(struct mmc_test_card *test)
...@@ -1263,11 +1229,7 @@ static int mmc_test_xfersize_write(struct mmc_test_card *test) ...@@ -1263,11 +1229,7 @@ static int mmc_test_xfersize_write(struct mmc_test_card *test)
if (ret) if (ret)
return ret; return ret;
ret = mmc_test_broken_transfer(test, 1, 512, 1); return mmc_test_broken_transfer(test, 1, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_xfersize_read(struct mmc_test_card *test) static int mmc_test_xfersize_read(struct mmc_test_card *test)
...@@ -1278,11 +1240,7 @@ static int mmc_test_xfersize_read(struct mmc_test_card *test) ...@@ -1278,11 +1240,7 @@ static int mmc_test_xfersize_read(struct mmc_test_card *test)
if (ret) if (ret)
return ret; return ret;
ret = mmc_test_broken_transfer(test, 1, 512, 0); return mmc_test_broken_transfer(test, 1, 512, 0);
if (ret)
return ret;
return 0;
} }
static int mmc_test_multi_xfersize_write(struct mmc_test_card *test) static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
...@@ -1296,11 +1254,7 @@ static int mmc_test_multi_xfersize_write(struct mmc_test_card *test) ...@@ -1296,11 +1254,7 @@ static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
if (ret) if (ret)
return ret; return ret;
ret = mmc_test_broken_transfer(test, 2, 512, 1); return mmc_test_broken_transfer(test, 2, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_multi_xfersize_read(struct mmc_test_card *test) static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
...@@ -1314,48 +1268,33 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test) ...@@ -1314,48 +1268,33 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
if (ret) if (ret)
return ret; return ret;
ret = mmc_test_broken_transfer(test, 2, 512, 0); return mmc_test_broken_transfer(test, 2, 512, 0);
if (ret)
return ret;
return 0;
} }
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
static int mmc_test_write_high(struct mmc_test_card *test) static int mmc_test_write_high(struct mmc_test_card *test)
{ {
int ret;
struct scatterlist sg; struct scatterlist sg;
sg_init_table(&sg, 1); sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, 512, 0); sg_set_page(&sg, test->highmem, 512, 0);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1); return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_read_high(struct mmc_test_card *test) static int mmc_test_read_high(struct mmc_test_card *test)
{ {
int ret;
struct scatterlist sg; struct scatterlist sg;
sg_init_table(&sg, 1); sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, 512, 0); sg_set_page(&sg, test->highmem, 512, 0);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0); return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
if (ret)
return ret;
return 0;
} }
static int mmc_test_multi_write_high(struct mmc_test_card *test) static int mmc_test_multi_write_high(struct mmc_test_card *test)
{ {
int ret;
unsigned int size; unsigned int size;
struct scatterlist sg; struct scatterlist sg;
...@@ -1373,16 +1312,11 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test) ...@@ -1373,16 +1312,11 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
sg_init_table(&sg, 1); sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, size, 0); sg_set_page(&sg, test->highmem, size, 0);
ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1); return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
if (ret)
return ret;
return 0;
} }
static int mmc_test_multi_read_high(struct mmc_test_card *test) static int mmc_test_multi_read_high(struct mmc_test_card *test)
{ {
int ret;
unsigned int size; unsigned int size;
struct scatterlist sg; struct scatterlist sg;
...@@ -1400,11 +1334,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test) ...@@ -1400,11 +1334,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
sg_init_table(&sg, 1); sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, size, 0); sg_set_page(&sg, test->highmem, size, 0);
ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0); return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
if (ret)
return ret;
return 0;
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment