staging: lustre: lnet: Replace sg++ with sg = sg_next(sg)
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Sat, 19 Mar 2016 12:32:55 +0000 (18:02 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
With scatterlist chaining, simply incrementing the array does not
work. sg_next macro was thus introduced to follow the chain links
when necessary. So replace sg++ with sg_next.

This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
struct scatterlist *sg;
@@
-sg++
+sg = sg_next(sg)
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c

index 2323e8d3a3182e99d75b65fa90d4b0be45daf83b..cd3fde7c4fbd314dc61c9819bc0492701fdb27f3 100644 (file)
@@ -704,7 +704,7 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
                fragnob = min(fragnob, (int)PAGE_SIZE - page_offset);
 
                sg_set_page(sg, page, fragnob, page_offset);
-               sg++;
+               sg = sg_next(sg);
 
                if (offset + fragnob < iov->iov_len) {
                        offset += fragnob;
@@ -748,7 +748,7 @@ kiblnd_setup_rd_kiov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
 
                sg_set_page(sg, kiov->kiov_page, fragnob,
                            kiov->kiov_offset + offset);
-               sg++;
+               sg = sg_next(sg);
 
                offset = 0;
                kiov++;