Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1501445 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2016-10-16 14:30 +0200 |
| Last post | 2016-10-19 16:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str Colin King <colin.king@canonical.com> - 2016-10-16 14:30 +0200
Re: [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str Vinod Koul <vinod.koul@intel.com> - 2016-10-19 16:40 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2016-10-16 14:30 +0200 |
| Subject | [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str |
| Message-ID | <ssSJH-5O2-9@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Vinod Koul <vinod.koul@intel.com> |
|---|---|
| Date | 2016-10-19 16:40 +0200 |
| Subject | Re: [PATCH] dmaengine: ioatdma: loop for number elements in array chanerr_str |
| Message-ID | <su0c9-2v4-5@gated-at.bofh.it> |
| In reply to | #1501445 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web