* [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str
@ 2016-10-16 12:25 Colin King
2016-10-19 14:47 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-10-16 12:25 UTC (permalink / raw)
To: Dan Williams, Vinod Koul, Dave Jiang, Lars-Peter Clausen,
dmaengine
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
---
drivers/dma/ioat/dma.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
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]);
}
}
}
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str
2016-10-16 12:25 [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str Colin King
@ 2016-10-19 14:47 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2016-10-19 14:47 UTC (permalink / raw)
To: Colin King
Cc: Dan Williams, Dave Jiang, Lars-Peter Clausen, dmaengine,
linux-kernel
On Sun, Oct 16, 2016 at 01:25:47PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-19 14:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16 12:25 [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str Colin King
2016-10-19 14:47 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox