diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-10-10 10:11:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-10-14 11:52:28 -0400 |
commit | db65c49e442cf9c9d9dc950f67daf109609f982a (patch) | |
tree | dbe7d1944232777e1533e43fbc475a3c17f4634d /drivers/media/usb/s2255 | |
parent | 45ae4a5220a43ae79dacb69054a2c7928dd91c94 (diff) |
[media] s2255drv: don't use stack for DMA
The USB control messages require DMA to work. We cannot pass
a stack-allocated buffer, as it is not warranted that the
stack would be into a DMA enabled area.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/s2255')
-rw-r--r-- | drivers/media/usb/s2255/s2255drv.c | 15 |
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 | ||