This is an automatic generated email to let you know that the following patch 
were queued:

Subject: [media] stk-webcam: don't use stack for DMA
Author:  Mauro Carvalho Chehab <mche...@osg.samsung.com>
Date:    Mon Oct 10 11:17:15 2016 -0300

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 <mche...@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com>

 drivers/media/usb/stkwebcam/stk-webcam.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

---

diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c 
b/drivers/media/usb/stkwebcam/stk-webcam.c
index db200c9d796d..22a9aae16291 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -147,20 +147,26 @@ int stk_camera_write_reg(struct stk_camera *dev, u16 
index, u8 value)
 int stk_camera_read_reg(struct stk_camera *dev, u16 index, int *value)
 {
        struct usb_device *udev = dev->udev;
+       unsigned char *buf;
        int ret;
 
+       buf = kmalloc(sizeof(u8), GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
        ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
                        0x00,
                        USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                        0x00,
                        index,
-                       (u8 *) value,
+                       buf,
                        sizeof(u8),
                        500);
-       if (ret < 0)
-               return ret;
-       else
-               return 0;
+       if (ret >= 0)
+               memcpy(value, buf, sizeof(u8));
+
+       kfree(buf);
+       return ret;
 }
 
 static int stk_start_stream(struct stk_camera *dev)

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to