[media] stk-webcam: 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>
This commit is contained in:
parent
db65c49e44
commit
b5f93cb513
@ -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)
|
int stk_camera_read_reg(struct stk_camera *dev, u16 index, int *value)
|
||||||
{
|
{
|
||||||
struct usb_device *udev = dev->udev;
|
struct usb_device *udev = dev->udev;
|
||||||
|
unsigned char *buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
buf = kmalloc(sizeof(u8), GFP_KERNEL);
|
||||||
|
if (!buf)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||||||
0x00,
|
0x00,
|
||||||
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
0x00,
|
0x00,
|
||||||
index,
|
index,
|
||||||
(u8 *) value,
|
buf,
|
||||||
sizeof(u8),
|
sizeof(u8),
|
||||||
500);
|
500);
|
||||||
if (ret < 0)
|
if (ret >= 0)
|
||||||
return ret;
|
memcpy(value, buf, sizeof(u8));
|
||||||
else
|
|
||||||
return 0;
|
kfree(buf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stk_start_stream(struct stk_camera *dev)
|
static int stk_start_stream(struct stk_camera *dev)
|
||||||
|
Loading…
Reference in New Issue
Block a user