Skip to content

Commit 707662d

Browse files
Yue Hustorulf
Yue Hu
authored andcommitted
mmc: test: clean up mmc_test_cleanup()
mmc_test_cleanup() has same body as __mmc_test_prepare() with write except the character to memset(). Signed-off-by: Yue Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 6d7ffe1 commit 707662d

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

drivers/mmc/core/mmc_test.c

+5-19
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ static unsigned int mmc_test_capacity(struct mmc_card *card)
624624
* Fill the first couple of sectors of the card with known data
625625
* so that bad reads/writes can be detected
626626
*/
627-
static int __mmc_test_prepare(struct mmc_test_card *test, int write)
627+
static int __mmc_test_prepare(struct mmc_test_card *test, int write, int val)
628628
{
629629
int ret, i;
630630

@@ -633,7 +633,7 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
633633
return ret;
634634

635635
if (write)
636-
memset(test->buffer, 0xDF, 512);
636+
memset(test->buffer, val, 512);
637637
else {
638638
for (i = 0; i < 512; i++)
639639
test->buffer[i] = i;
@@ -650,31 +650,17 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
650650

651651
static int mmc_test_prepare_write(struct mmc_test_card *test)
652652
{
653-
return __mmc_test_prepare(test, 1);
653+
return __mmc_test_prepare(test, 1, 0xDF);
654654
}
655655

656656
static int mmc_test_prepare_read(struct mmc_test_card *test)
657657
{
658-
return __mmc_test_prepare(test, 0);
658+
return __mmc_test_prepare(test, 0, 0);
659659
}
660660

661661
static int mmc_test_cleanup(struct mmc_test_card *test)
662662
{
663-
int ret, i;
664-
665-
ret = mmc_test_set_blksize(test, 512);
666-
if (ret)
667-
return ret;
668-
669-
memset(test->buffer, 0, 512);
670-
671-
for (i = 0; i < BUFFER_SIZE / 512; i++) {
672-
ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
673-
if (ret)
674-
return ret;
675-
}
676-
677-
return 0;
663+
return __mmc_test_prepare(test, 1, 0);
678664
}
679665

680666
/*******************************************************************/

0 commit comments

Comments
 (0)