Use the scatterlist iterators and remove direct indexing of the
scatterlist array.

This way allows us to pre-allocate one small scatterlist, which can be
chained with one runtime allocated scatterlist if the pre-allocated one
isn't enough for the whole request.

Reviewed-by: Christoph Hellwig <h...@lst.de>
Reviewed-by: Bart Van Assche <bvanass...@acm.org>
Signed-off-by: Ming Lei <ming....@redhat.com>
---
 drivers/scsi/ppa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 35213082e933..a406cc825426 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -590,7 +590,7 @@ static int ppa_completion(struct scsi_cmnd *cmd)
                if (cmd->SCp.buffer && !cmd->SCp.this_residual) {
                        /* if scatter/gather, advance to the next segment */
                        if (cmd->SCp.buffers_residual--) {
-                               cmd->SCp.buffer++;
+                               cmd->SCp.buffer = sg_next(cmd->SCp.buffer);
                                cmd->SCp.this_residual =
                                    cmd->SCp.buffer->length;
                                cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
-- 
2.20.1

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to