aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 011c0a8a2dcc..0d51d13b16bf 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1332,7 +1332,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1332} 1332}
1333 1333
1334/** 1334/**
1335 * ata_exec_internal_sg - execute libata internal command 1335 * ata_exec_internal - execute libata internal command
1336 * @dev: Device to which the command is sent 1336 * @dev: Device to which the command is sent
1337 * @tf: Taskfile registers for the command and the result 1337 * @tf: Taskfile registers for the command and the result
1338 * @cdb: CDB for packet command 1338 * @cdb: CDB for packet command
@@ -1353,11 +1353,17 @@ unsigned ata_exec_internal(struct ata_device *dev,
1353 struct ata_taskfile *tf, const u8 *cdb, 1353 struct ata_taskfile *tf, const u8 *cdb,
1354 int dma_dir, void *buf, unsigned int buflen) 1354 int dma_dir, void *buf, unsigned int buflen)
1355{ 1355{
1356 struct scatterlist sg; 1356 struct scatterlist *psg = NULL, sg;
1357 unsigned int n_elem = 0;
1357 1358
1358 sg_init_one(&sg, buf, buflen); 1359 if (dma_dir != DMA_NONE) {
1360 WARN_ON(!buf);
1361 sg_init_one(&sg, buf, buflen);
1362 psg = &sg;
1363 n_elem++;
1364 }
1359 1365
1360 return ata_exec_internal_sg(dev, tf, cdb, dma_dir, &sg, 1); 1366 return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem);
1361} 1367}
1362 1368
1363/** 1369/**