ioat3: fix uninitialized var warnings
drivers/dma/ioat/dma_v3.c: In function 'ioat3_prep_memset_lock':
drivers/dma/ioat/dma_v3.c:439: warning: 'fill' may be used uninitialized in this function
drivers/dma/ioat/dma_v3.c:437: warning: 'desc' may be used uninitialized in this function
drivers/dma/ioat/dma_v3.c: In function '__ioat3_prep_xor_lock':
drivers/dma/ioat/dma_v3.c:489: warning: 'xor' may be used uninitialized in this function
drivers/dma/ioat/dma_v3.c:486: warning: 'desc' may be used uninitialized in this function
drivers/dma/ioat/dma_v3.c: In function '__ioat3_prep_pq_lock':
drivers/dma/ioat/dma_v3.c:631: warning: 'pq' may be used uninitialized in this function
drivers/dma/ioat/dma_v3.c:628: warning: 'desc' may be used uninitialized in this function
gcc-4.0, unlike gcc-4.3, does not see that these variables are
initialized before use. Convert the descriptor loops to do-while make
this initialization apparent.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index 3686ddd..35d1e33 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -448,7 +448,8 @@
/* pass */;
else
return NULL;
- for (i = 0; i < num_descs; i++) {
+ i = 0;
+ do {
size_t xfer_size = min_t(size_t, len, 1 << ioat->xfercap_log);
desc = ioat2_get_ring_ent(ioat, idx + i);
@@ -463,7 +464,7 @@
len -= xfer_size;
dest += xfer_size;
dump_desc_dbg(ioat, desc);
- }
+ } while (++i < num_descs);
desc->txd.flags = flags;
desc->len = total_len;
@@ -518,7 +519,8 @@
/* pass */;
else
return NULL;
- for (i = 0; i < num_descs; i += 1 + with_ext) {
+ i = 0;
+ do {
struct ioat_raw_descriptor *descs[2];
size_t xfer_size = min_t(size_t, len, 1 << ioat->xfercap_log);
int s;
@@ -546,7 +548,7 @@
len -= xfer_size;
offset += xfer_size;
dump_desc_dbg(ioat, desc);
- }
+ } while ((i += 1 + with_ext) < num_descs);
/* last xor descriptor carries the unmap parameters and fence bit */
desc->txd.flags = flags;
@@ -664,7 +666,8 @@
/* pass */;
else
return NULL;
- for (i = 0; i < num_descs; i += 1 + with_ext) {
+ i = 0;
+ do {
struct ioat_raw_descriptor *descs[2];
size_t xfer_size = min_t(size_t, len, 1 << ioat->xfercap_log);
@@ -703,7 +706,7 @@
len -= xfer_size;
offset += xfer_size;
- }
+ } while ((i += 1 + with_ext) < num_descs);
/* last pq descriptor carries the unmap parameters and fence bit */
desc->txd.flags = flags;