[PATCH 3/8] staging: mt7621-mmc: Fix dma_map_sg may map to fewer entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The dma_map_sg function may merge several sglist entries into one, the
return value has to be saved to consider that. The data->sg_count
field is the position, where it should be saved, like it is done in
other mmc host drivers. Also the count of mapped entries is needed for
the dma setup.

Signed-off-by: Christian Lütke-Stetzkamp <christian@xxxxxxxx>
Reviewed-by: NeilBrown <neil@xxxxxxxxx>
---
 drivers/staging/mt7621-mmc/sd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index d464e2a321da..f11eb1fe3f6a 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1423,8 +1423,10 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq)
 				goto done;
 
 			dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
-			(void)dma_map_sg(mmc_dev(mmc), data->sg, data->sg_len, dir);
-			msdc_dma_setup(host, &host->dma, data->sg, data->sg_len);
+			data->sg_count = dma_map_sg(mmc_dev(mmc), data->sg,
+						    data->sg_len, dir);
+			msdc_dma_setup(host, &host->dma, data->sg,
+				       data->sg_count);
 
 			/* then wait command done */
 			if (msdc_command_resp(host, cmd, 1, CMD_TIMEOUT) != 0)
-- 
2.16.1

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




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux