Skip to contentSkip to conversation

memstick: tifm_ms: use the correct DMA direction on removal

PATCH In review Avi Weiss 2 participants 2 messages Oct 30 – Nov 10

Subsystems (3)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 memstick: tifm_ms: use the correct DMA direction on removal

tifm_ms_issue_cmd() maps READ requests with DMA_FROM_DEVICE and WRITE requests with DMA_TO_DEVICE. When a request is active during removal, tifm_ms_remove() unmaps it using the opposite direction.

Use the original mapping direction when unmapping an active request, matching the normal completion path.

Fixes baf8532a147d ("memstick: initial commit for Sony MemoryStick support")
---
 drivers/memstick/host/tifm_ms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memstick/host/tifm_ms.c +2 -2
index 0a54586aa54e8..171aadd4ec71a 100644
@@ -606,8 +606,8 @@ static void tifm_ms_remove(struct tifm_dev *sock)
 		if (host->use_dma)
 			tifm_unmap_sg(sock, &host->req->sg, 1,
 				      host->req->data_dir == READ
-				      ? DMA_TO_DEVICE
-				      : DMA_FROM_DEVICE);
+				      ? DMA_FROM_DEVICE
+				      : DMA_TO_DEVICE);
 		host->req->error = -ETIME;
 
 		do {

base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3

Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Avi Weiss

tifm_ms_issue_cmd() maps READ requests with DMA_FROM_DEVICE and WRITE requests with DMA_TO_DEVICE. When a request is active during removal, tifm_ms_remove() unmaps it using the opposite direction.

Use the original mapping direction when unmapping an active request, matching the normal completion path.

Fixes baf8532a147d ("memstick: initial commit for Sony MemoryStick support")

Applied for next, thanks!

Kind regards
Uffe

Quoted 24 lines
---
 drivers/memstick/host/tifm_ms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memstick/host/tifm_ms.c +2 -2
index 0a54586aa54e8..171aadd4ec71a 100644
@@ -606,8 +606,8 @@ static void tifm_ms_remove(struct tifm_dev *sock)
                if (host->use_dma)
                        tifm_unmap_sg(sock, &host->req->sg, 1,
                                      host->req->data_dir == READ
-                                     ? DMA_TO_DEVICE
-                                     : DMA_FROM_DEVICE);
+                                     ? DMA_FROM_DEVICE
+                                     : DMA_TO_DEVICE);
                host->req->error = -ETIME;
 
                do {

base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3 --
2.43.0