Skip to content

Commit

Permalink
mtip32xxx: use for_each_sg
Browse files Browse the repository at this point in the history
Use the proper helper instead of manually iterating the scatterlist,
which is broken in the presence of chained S/G lists.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Nov 9, 2018
1 parent d85cb20 commit 27d420b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/block/mtip32xx/mtip32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1549,11 +1549,11 @@ static inline void fill_command_sg(struct driver_data *dd,
int n;
unsigned int dma_len;
struct mtip_cmd_sg *command_sg;
struct scatterlist *sg = command->sg;
struct scatterlist *sg;

command_sg = command->command + AHCI_CMD_TBL_HDR_SZ;

for (n = 0; n < nents; n++) {
for_each_sg(command->sg, sg, nents, n) {
dma_len = sg_dma_len(sg);
if (dma_len > 0x400000)
dev_err(&dd->pdev->dev,
Expand All @@ -1563,7 +1563,6 @@ static inline void fill_command_sg(struct driver_data *dd,
command_sg->dba_upper =
cpu_to_le32((sg_dma_address(sg) >> 16) >> 16);
command_sg++;
sg++;
}
}

Expand Down

0 comments on commit 27d420b

Please sign in to comment.