V4L/DVB: gspca - main: add urb buffer flags
PATCH 1/1 V4L/DVB: gspca - main: add urb buffer flags
When i plug a ZC3xx usb webcam to the host port of fsl_imx51pdk(arm), the system crashes like this:
usb 1-1: new full speed USB device using fsl-ehci and address 2
gspca: probing 0ac8:301b
zc3xx: probe sensor -> 000a
zc3xx: Find Sensor PB0330. Chip revision 0
input: zc3xx as /devices/platform/fsl-ehci.0/usb1/1-1/input/input0
gspca: video1 created
gspca: found int in endpoint: 0x82, buffer_len=8, interval=10 kernel BUG at /home/hwang4/work/build/51/build/linux/arch/arm/mm/\
dma-mapping.c:411!
Unable to handle kernel NULL pointer dereference at virtual address \ 00000000 pgd = c0004000 [00000000] *pgd=00000000 Internal error: Oops: 817 [#1] PREEMPT
This is because we alloc buffer for an urb through usb_buffer_alloc, the alloced buffer is already in DMA coherent region, so we should set the flag of this urb to URB_NO_TRANSFER_DMA_MAP, otherwise when we submit this urb, the hcd core will handle this address as an non-DMA address and call dma_map_single/sg to map it. On arm architecture, dma_map_single a DMA coherent address will be catched by a BUG_ON().
--- drivers/media/video/gspca/gspca.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/media/video/gspca/gspca.c +1 -0
@@ -223,6 +223,7 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev,usb_rcvintpipe (dev, ep->bEndpointAddress), buffer, buffer_len, int_irq, (void *)gspca_dev, interval); + urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ; gspca_dev->int_urb = urb; ret =usb_submit_urb (urb,GFP_KERNEL );if (ret <0 ) {
Signature · 1 line
1.5.6.5