[PATCH master 21/23] usb: dwc2: host: fix mismatch between dma_map_single and unmap

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 23 23:40:56 PDT 2024


xfer_len is used as argument to dma_unmap_single, so changing it value
to one different from dma_map_single will have CONFIG_DMA_API_DEBUG
complain.

Besides the unmap, xfer_len is only used to compute *actual_len, so do
arithmetic only on that to fix the warning.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/usb/dwc2/host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/host.c b/drivers/usb/dwc2/host.c
index 344f058be208..a9b25aeeaa11 100644
--- a/drivers/usb/dwc2/host.c
+++ b/drivers/usb/dwc2/host.c
@@ -209,9 +209,9 @@ static int transfer_chunk(struct dwc2 *dwc2, u8 hc,
 	if (ret < 0)
 		goto exit;
 
-	if (in)
-		xfer_len -= sub;
 	*actual_len = xfer_len;
+	if (in)
+		*actual_len -= sub;
 
 exit:
 	if (xfer_len)
-- 
2.39.2




More information about the barebox mailing list