diff mbox

Bug in mmc_test or host driver?

Message ID 4C67FC00.8080207@nokia.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Adrian Hunter Aug. 15, 2010, 2:38 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 5dd8576..4fb8b10 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1328,6 +1328,10 @@  static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
 		t->max_sz = TEST_AREA_MAX_SIZE;
 	else
 		t->max_sz = (unsigned long)test->card->pref_erase << 9;
+	if (t->max_sz >> 9 > test->card->host->max_blk_count)
+		t->max_sz = test->card->host->max_blk_count << 9;
+	if (min_sz > t->max_sz)
+		min_sz = t->max_sz;
 	/*
 	 * Try to allocate enough memory for the whole area.  Less is OK
 	 * because the same memory can be mapped into the scatterlist more than