From 4dce3b375179fdd4aba2191be11ace90ef0ec6d6 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Fri, 19 Aug 2022 08:07:48 +0200 Subject: usb/hcd: Fix dma_map_sg error check dma_map_sg return 0 on error. Cc: Alan Stern Cc: Kishon Vijay Abraham I Cc: Alexey Sheplyakov Cc: Stephen Boyd Cc: Weitao Wang Cc: Matthias Kaehlcke Cc: Arnd Bergmann Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang Link: https://lore.kernel.org/r/20220819060801.10443-7-jinpu.wang@ionos.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 94b305bbd621..90dd32a24e5b 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1474,7 +1474,7 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, urb->sg, urb->num_sgs, dir); - if (n <= 0) + if (!n) ret = -EAGAIN; else urb->transfer_flags |= URB_DMA_MAP_SG; -- cgit v1.2.3