Skip to content

Commit 74b5c07

Browse files
andy-shevVinod Koul
authored andcommitted
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent 3e5ccd8 commit 74b5c07

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/dma/dmatest.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ module_param(timeout, uint, S_IRUGO);
6666
MODULE_PARM_DESC(timeout, "Transfer Timeout in msec (default: 3000), "
6767
"Pass -1 for infinite timeout");
6868

69+
/* Maximum amount of mismatched bytes in buffer to print */
70+
#define MAX_ERROR_COUNT 32
71+
6972
/*
7073
* Initialization patterns. All bytes in the source buffer has bit 7
7174
* 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,
249252
actual = buf[i];
250253
expected = pattern | (~counter & PATTERN_COUNT_MASK);
251254
if (actual != expected) {
252-
if (error_count < 32)
255+
if (error_count < MAX_ERROR_COUNT)
253256
dmatest_mismatch(actual, pattern, i,
254257
counter, is_srcbuf);
255258
error_count++;
@@ -258,9 +261,9 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start,
258261
}
259262
}
260263

261-
if (error_count > 32)
264+
if (error_count > MAX_ERROR_COUNT)
262265
pr_warning("%s: %u errors suppressed\n",
263-
current->comm, error_count - 32);
266+
current->comm, error_count - MAX_ERROR_COUNT);
264267

265268
return error_count;
266269
}

0 commit comments

Comments
 (0)