diff options
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 708270a46e1f..1225c0fe26f0 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -334,7 +334,7 @@ static void *rvmalloc(unsigned long size) | |||
334 | 334 | ||
335 | /* size = PAGE_ALIGN(size); (already done) */ | 335 | /* size = PAGE_ALIGN(size); (already done) */ |
336 | mem = vmalloc_32(size); | 336 | mem = vmalloc_32(size); |
337 | if (mem != 0) { | 337 | if (mem != NULL) { |
338 | memset(mem, 0, size); | 338 | memset(mem, 0, size); |
339 | adr = (unsigned long) mem; | 339 | adr = (unsigned long) mem; |
340 | while ((long) size > 0) { | 340 | while ((long) size > 0) { |
@@ -464,7 +464,7 @@ static void frame_free(struct gspca_dev *gspca_dev) | |||
464 | int i; | 464 | int i; |
465 | 465 | ||
466 | PDEBUG(D_STREAM, "frame free"); | 466 | PDEBUG(D_STREAM, "frame free"); |
467 | if (gspca_dev->frbuf != 0) { | 467 | if (gspca_dev->frbuf != NULL) { |
468 | rvfree(gspca_dev->frbuf, | 468 | rvfree(gspca_dev->frbuf, |
469 | gspca_dev->nframes * gspca_dev->frsz); | 469 | gspca_dev->nframes * gspca_dev->frsz); |
470 | gspca_dev->frbuf = NULL; | 470 | gspca_dev->frbuf = NULL; |
@@ -487,7 +487,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) | |||
487 | 487 | ||
488 | gspca_dev->urb[i] = NULL; | 488 | gspca_dev->urb[i] = NULL; |
489 | usb_kill_urb(urb); | 489 | usb_kill_urb(urb); |
490 | if (urb->transfer_buffer != 0) | 490 | if (urb->transfer_buffer != NULL) |
491 | usb_buffer_free(gspca_dev->dev, | 491 | usb_buffer_free(gspca_dev->dev, |
492 | urb->transfer_buffer_length, | 492 | urb->transfer_buffer_length, |
493 | urb->transfer_buffer, | 493 | urb->transfer_buffer, |
@@ -991,7 +991,7 @@ static int dev_close(struct inode *inode, struct file *file) | |||
991 | gspca_dev->sd_desc->close(gspca_dev); | 991 | gspca_dev->sd_desc->close(gspca_dev); |
992 | mutex_unlock(&gspca_dev->usb_lock); | 992 | mutex_unlock(&gspca_dev->usb_lock); |
993 | frame_free(gspca_dev); | 993 | frame_free(gspca_dev); |
994 | gspca_dev->capt_file = 0; | 994 | gspca_dev->capt_file = NULL; |
995 | gspca_dev->memory = GSPCA_MEMORY_NO; | 995 | gspca_dev->memory = GSPCA_MEMORY_NO; |
996 | } | 996 | } |
997 | file->private_data = NULL; | 997 | file->private_data = NULL; |
@@ -1165,7 +1165,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | /* only one file may do capture */ | 1167 | /* only one file may do capture */ |
1168 | if ((gspca_dev->capt_file != 0 && gspca_dev->capt_file != file) | 1168 | if ((gspca_dev->capt_file != NULL && gspca_dev->capt_file != file) |
1169 | || gspca_dev->streaming) { | 1169 | || gspca_dev->streaming) { |
1170 | ret = -EBUSY; | 1170 | ret = -EBUSY; |
1171 | goto out; | 1171 | goto out; |
@@ -1173,7 +1173,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1173 | 1173 | ||
1174 | if (rb->count == 0) { /* unrequest? */ | 1174 | if (rb->count == 0) { /* unrequest? */ |
1175 | frame_free(gspca_dev); | 1175 | frame_free(gspca_dev); |
1176 | gspca_dev->capt_file = 0; | 1176 | gspca_dev->capt_file = NULL; |
1177 | } else { | 1177 | } else { |
1178 | gspca_dev->memory = rb->memory; | 1178 | gspca_dev->memory = rb->memory; |
1179 | ret = frame_alloc(gspca_dev, rb->count); | 1179 | ret = frame_alloc(gspca_dev, rb->count); |
@@ -1382,7 +1382,7 @@ static int vidiocgmbuf(struct file *file, void *priv, | |||
1382 | static int dev_mmap(struct file *file, struct vm_area_struct *vma) | 1382 | static int dev_mmap(struct file *file, struct vm_area_struct *vma) |
1383 | { | 1383 | { |
1384 | struct gspca_dev *gspca_dev = file->private_data; | 1384 | struct gspca_dev *gspca_dev = file->private_data; |
1385 | struct gspca_frame *frame = 0; | 1385 | struct gspca_frame *frame; |
1386 | struct page *page; | 1386 | struct page *page; |
1387 | unsigned long addr, start, size; | 1387 | unsigned long addr, start, size; |
1388 | int i, ret; | 1388 | int i, ret; |
@@ -1405,6 +1405,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma) | |||
1405 | goto out; | 1405 | goto out; |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | frame = NULL; | ||
1408 | for (i = 0; i < gspca_dev->nframes; ++i) { | 1409 | for (i = 0; i < gspca_dev->nframes; ++i) { |
1409 | if (gspca_dev->frame[i].v4l2_buf.memory != V4L2_MEMORY_MMAP) { | 1410 | if (gspca_dev->frame[i].v4l2_buf.memory != V4L2_MEMORY_MMAP) { |
1410 | PDEBUG(D_STREAM, "mmap bad memory type"); | 1411 | PDEBUG(D_STREAM, "mmap bad memory type"); |
@@ -1416,7 +1417,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma) | |||
1416 | break; | 1417 | break; |
1417 | } | 1418 | } |
1418 | } | 1419 | } |
1419 | if (frame == 0) { | 1420 | if (frame == NULL) { |
1420 | PDEBUG(D_STREAM, "mmap no frame buffer found"); | 1421 | PDEBUG(D_STREAM, "mmap no frame buffer found"); |
1421 | ret = -EINVAL; | 1422 | ret = -EINVAL; |
1422 | goto out; | 1423 | goto out; |