aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/s2255/s2255drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/usb/s2255/s2255drv.c')
-rw-r--r--drivers/media/usb/s2255/s2255drv.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index c3a0e87066eb..f7bb78c1873c 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -1901,19 +1901,30 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request,
1901 s32 TransferBufferLength, int bOut) 1901 s32 TransferBufferLength, int bOut)
1902{ 1902{
1903 int r; 1903 int r;
1904 unsigned char *buf;
1905
1906 buf = kmalloc(TransferBufferLength, GFP_KERNEL);
1907 if (!buf)
1908 return -ENOMEM;
1909
1904 if (!bOut) { 1910 if (!bOut) {
1905 r = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 1911 r = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
1906 Request, 1912 Request,
1907 USB_TYPE_VENDOR | USB_RECIP_DEVICE | 1913 USB_TYPE_VENDOR | USB_RECIP_DEVICE |
1908 USB_DIR_IN, 1914 USB_DIR_IN,
1909 Value, Index, TransferBuffer, 1915 Value, Index, buf,
1910 TransferBufferLength, HZ * 5); 1916 TransferBufferLength, HZ * 5);
1917
1918 if (r >= 0)
1919 memcpy(TransferBuffer, buf, TransferBufferLength);
1911 } else { 1920 } else {
1921 memcpy(buf, TransferBuffer, TransferBufferLength);
1912 r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 1922 r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
1913 Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1923 Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1914 Value, Index, TransferBuffer, 1924 Value, Index, buf,
1915 TransferBufferLength, HZ * 5); 1925 TransferBufferLength, HZ * 5);
1916 } 1926 }
1927 kfree(buf);
1917 return r; 1928 return r;
1918} 1929}
1919 1930