Commit 74b5c07a authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Vinod Koul

dmatest: define MAX_ERROR_COUNT constant

Its meaning is to limit amount of error messages to be printed out when buffer
mismatch is occured.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 3e5ccd86
...@@ -66,6 +66,9 @@ module_param(timeout, uint, S_IRUGO); ...@@ -66,6 +66,9 @@ module_param(timeout, uint, S_IRUGO);
MODULE_PARM_DESC(timeout, "Transfer Timeout in msec (default: 3000), " MODULE_PARM_DESC(timeout, "Transfer Timeout in msec (default: 3000), "
"Pass -1 for infinite timeout"); "Pass -1 for infinite timeout");
/* Maximum amount of mismatched bytes in buffer to print */
#define MAX_ERROR_COUNT 32
/* /*
* Initialization patterns. All bytes in the source buffer has bit 7 * Initialization patterns. All bytes in the source buffer has bit 7
* set, all bytes in the destination buffer has bit 7 cleared. * set, all bytes in the destination buffer has bit 7 cleared.
...@@ -249,7 +252,7 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start, ...@@ -249,7 +252,7 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start,
actual = buf[i]; actual = buf[i];
expected = pattern | (~counter & PATTERN_COUNT_MASK); expected = pattern | (~counter & PATTERN_COUNT_MASK);
if (actual != expected) { if (actual != expected) {
if (error_count < 32) if (error_count < MAX_ERROR_COUNT)
dmatest_mismatch(actual, pattern, i, dmatest_mismatch(actual, pattern, i,
counter, is_srcbuf); counter, is_srcbuf);
error_count++; error_count++;
...@@ -258,9 +261,9 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start, ...@@ -258,9 +261,9 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start,
} }
} }
if (error_count > 32) if (error_count > MAX_ERROR_COUNT)
pr_warning("%s: %u errors suppressed\n", pr_warning("%s: %u errors suppressed\n",
current->comm, error_count - 32); current->comm, error_count - MAX_ERROR_COUNT);
return error_count; return error_count;
} }
......
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