diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2016-04-27 23:42:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-28 15:35:36 -0400 |
commit | 26186e5f2c1a6d1c244a3052f02e46ae29d823f2 (patch) | |
tree | f11ffd2e06d3e622175e24893917af145ead163f /drivers/usb/misc/usbtest.c | |
parent | f5e6253fe6de35fc2fa059974dbd9d61f32e4cd0 (diff) |
usb: misc: usbtest: fix error of urb allocation
urb allocation will fail when usbtest_alloc_urb() tries to
allocate zero length buffer, but it doesn't need it in fact,
so just skips buffer allocation in the case.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r-- | drivers/usb/misc/usbtest.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 92fdb6e9faff..de485d8a5beb 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -287,6 +287,9 @@ static struct urb *usbtest_alloc_urb( | |||
287 | if (usb_pipein(pipe)) | 287 | if (usb_pipein(pipe)) |
288 | urb->transfer_flags |= URB_SHORT_NOT_OK; | 288 | urb->transfer_flags |= URB_SHORT_NOT_OK; |
289 | 289 | ||
290 | if ((bytes + offset) == 0) | ||
291 | return urb; | ||
292 | |||
290 | if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) | 293 | if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) |
291 | urb->transfer_buffer = usb_alloc_coherent(udev, bytes + offset, | 294 | urb->transfer_buffer = usb_alloc_coherent(udev, bytes + offset, |
292 | GFP_KERNEL, &urb->transfer_dma); | 295 | GFP_KERNEL, &urb->transfer_dma); |