summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2021-05-08 08:33:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-13 17:02:30 +0300
commit216e0e563d81ff9a16627b3d95cbfe5fa88153d7 (patch)
tree648de2af1c052bce2beccda0466399e05f4de34f /drivers
parentcbbc07e1e892c373f30f4ba08fedecd49afca247 (diff)
downloadlinux-216e0e563d81ff9a16627b3d95cbfe5fa88153d7.tar.xz
usb: core: hcd: use map_urb_for_dma for single step set feature urb
Use map_urb_for_dma() to improve the dma map code for single step set feature request urb in test mode. Signed-off-by: Li Jun <jun.li@nxp.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/1620452039-11694-3-git-send-email-jun.li@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/hcd.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d7eb9f179ca6..0f8b7c93310e 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2159,16 +2159,12 @@ static struct urb *request_single_step_set_feature_urb(
usb_get_urb(urb);
atomic_inc(&urb->use_count);
atomic_inc(&urb->dev->urbnum);
- urb->setup_dma = dma_map_single(
- hcd->self.sysdev,
- urb->setup_packet,
- sizeof(struct usb_ctrlrequest),
- DMA_TO_DEVICE);
- urb->transfer_dma = dma_map_single(
- hcd->self.sysdev,
- urb->transfer_buffer,
- urb->transfer_buffer_length,
- DMA_FROM_DEVICE);
+ if (map_urb_for_dma(hcd, urb, GFP_KERNEL)) {
+ usb_put_urb(urb);
+ usb_free_urb(urb);
+ return NULL;
+ }
+
urb->context = done;
return urb;
}