Skip to content

Commit 27d420b

Browse files
Christoph Hellwigaxboe
authored andcommitted
mtip32xxx: use for_each_sg
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>
1 parent d85cb20 commit 27d420b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,11 +1549,11 @@ static inline void fill_command_sg(struct driver_data *dd,
15491549
int n;
15501550
unsigned int dma_len;
15511551
struct mtip_cmd_sg *command_sg;
1552-
struct scatterlist *sg = command->sg;
1552+
struct scatterlist *sg;
15531553

15541554
command_sg = command->command + AHCI_CMD_TBL_HDR_SZ;
15551555

1556-
for (n = 0; n < nents; n++) {
1556+
for_each_sg(command->sg, sg, nents, n) {
15571557
dma_len = sg_dma_len(sg);
15581558
if (dma_len > 0x400000)
15591559
dev_err(&dd->pdev->dev,
@@ -1563,7 +1563,6 @@ static inline void fill_command_sg(struct driver_data *dd,
15631563
command_sg->dba_upper =
15641564
cpu_to_le32((sg_dma_address(sg) >> 16) >> 16);
15651565
command_sg++;
1566-
sg++;
15671566
}
15681567
}
15691568

0 commit comments

Comments
 (0)