Commit 1b779416 authored by Colin Ian King's avatar Colin Ian King Committed by Vinod Koul

dmaengine: ioatdma: loop for number elements in array chanerr_str

Just iterate over the number of elements in array chanerr_str rather
than for all 32 bits.  This removes the need for a NULL chanerr_str[i]
check which could possibly overrun if the upper bits (28..31) of
chanerr are set and 27th bit in chanerr is zero. This simplifies the
code by removing an if statement and a break.
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 1001354c
...@@ -66,7 +66,6 @@ static char *chanerr_str[] = { ...@@ -66,7 +66,6 @@ static char *chanerr_str[] = {
"Result Guard Tag verification Error", "Result Guard Tag verification Error",
"Result Application Tag verification Error", "Result Application Tag verification Error",
"Result Reference Tag verification Error", "Result Reference Tag verification Error",
NULL
}; };
static void ioat_eh(struct ioatdma_chan *ioat_chan); static void ioat_eh(struct ioatdma_chan *ioat_chan);
...@@ -75,13 +74,10 @@ static void ioat_print_chanerrs(struct ioatdma_chan *ioat_chan, u32 chanerr) ...@@ -75,13 +74,10 @@ static void ioat_print_chanerrs(struct ioatdma_chan *ioat_chan, u32 chanerr)
{ {
int i; int i;
for (i = 0; i < 32; i++) { for (i = 0; i < ARRAY_SIZE(chanerr_str); i++) {
if ((chanerr >> i) & 1) { if ((chanerr >> i) & 1) {
if (chanerr_str[i]) { dev_err(to_dev(ioat_chan), "Err(%d): %s\n",
dev_err(to_dev(ioat_chan), "Err(%d): %s\n", i, chanerr_str[i]);
i, chanerr_str[i]);
} else
break;
} }
} }
} }
......
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