From: Colin Ian King Date: Sun, 16 Oct 2016 12:25:47 +0000 (+0100) Subject: dmaengine: ioatdma: loop for number elements in array chanerr_str X-Git-Tag: v4.10-rc1~108^2~5^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b7794163ab35a06b32b04ff558819ebb684b1c2;p=platform%2Fkernel%2Flinux-exynos.git 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: Colin Ian King Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 49386ce0..42ff307 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -66,7 +66,6 @@ static char *chanerr_str[] = { "Result Guard Tag verification Error", "Result Application Tag verification Error", "Result Reference Tag verification Error", - NULL }; 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) { int i; - for (i = 0; i < 32; i++) { + for (i = 0; i < ARRAY_SIZE(chanerr_str); i++) { if ((chanerr >> i) & 1) { - if (chanerr_str[i]) { - dev_err(to_dev(ioat_chan), "Err(%d): %s\n", - i, chanerr_str[i]); - } else - break; + dev_err(to_dev(ioat_chan), "Err(%d): %s\n", + i, chanerr_str[i]); } } }