aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorErik Andren <erik.andren@gmail.com>2008-10-03 07:46:50 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:37:13 -0400
commite293e599524f74532b0add53ddf80f10ff854598 (patch)
treeec8306de58b273b79e507df183f0d9cec835ef5d /drivers/media/video/gspca/gspca.c
parentc109f8168f259ea1f1ab7009c6b99dbe8ea0e2b2 (diff)
V4L/DVB (9093): gspca: Cleanup code and small changes.
- convert some #define to enum. - remove some comments. - return ENOMEM on memory allocation failure. Signed-off-by: Erik Andren <erik.andren@gmail.com> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 02824fc101d5..9db3d899aa61 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -237,7 +237,7 @@ static void bulk_irq(struct urb *urb
237 * On LAST_PACKET, a new frame is returned. 237 * On LAST_PACKET, a new frame is returned.
238 */ 238 */
239struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, 239struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
240 int packet_type, 240 enum gspca_packet_type packet_type,
241 struct gspca_frame *frame, 241 struct gspca_frame *frame,
242 const __u8 *data, 242 const __u8 *data,
243 int len) 243 int len)
@@ -317,7 +317,6 @@ static void *rvmalloc(unsigned long size)
317 void *mem; 317 void *mem;
318 unsigned long adr; 318 unsigned long adr;
319 319
320/* size = PAGE_ALIGN(size); (already done) */
321 mem = vmalloc_32(size); 320 mem = vmalloc_32(size);
322 if (mem != NULL) { 321 if (mem != NULL) {
323 adr = (unsigned long) mem; 322 adr = (unsigned long) mem;
@@ -937,7 +936,6 @@ static int vidioc_querycap(struct file *file, void *priv,
937 936
938 memset(cap, 0, sizeof *cap); 937 memset(cap, 0, sizeof *cap);
939 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver); 938 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver);
940/* strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); */
941 if (gspca_dev->dev->product != NULL) { 939 if (gspca_dev->dev->product != NULL) {
942 strncpy(cap->card, gspca_dev->dev->product, 940 strncpy(cap->card, gspca_dev->dev->product,
943 sizeof cap->card); 941 sizeof cap->card);
@@ -1571,7 +1569,6 @@ static int vidioc_qbuf(struct file *file, void *priv,
1571 } 1569 }
1572 1570
1573 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_QUEUED; 1571 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_QUEUED;
1574/* frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; */
1575 1572
1576 if (frame->v4l2_buf.memory == V4L2_MEMORY_USERPTR) { 1573 if (frame->v4l2_buf.memory == V4L2_MEMORY_USERPTR) {
1577 frame->v4l2_buf.m.userptr = v4l2_buf->m.userptr; 1574 frame->v4l2_buf.m.userptr = v4l2_buf->m.userptr;
@@ -1836,22 +1833,21 @@ int gspca_dev_probe(struct usb_interface *intf,
1836 if (dev_size < sizeof *gspca_dev) 1833 if (dev_size < sizeof *gspca_dev)
1837 dev_size = sizeof *gspca_dev; 1834 dev_size = sizeof *gspca_dev;
1838 gspca_dev = kzalloc(dev_size, GFP_KERNEL); 1835 gspca_dev = kzalloc(dev_size, GFP_KERNEL);
1839 if (gspca_dev == NULL) { 1836 if (!gspca_dev) {
1840 err("couldn't kzalloc gspca struct"); 1837 err("couldn't kzalloc gspca struct");
1841 return -EIO; 1838 return -ENOMEM;
1842 } 1839 }
1843 kref_init(&gspca_dev->kref); 1840 kref_init(&gspca_dev->kref);
1844 gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL); 1841 gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL);
1845 if (!gspca_dev->usb_buf) { 1842 if (!gspca_dev->usb_buf) {
1846 err("out of memory"); 1843 err("out of memory");
1847 ret = -EIO; 1844 ret = -ENOMEM;
1848 goto out; 1845 goto out;
1849 } 1846 }
1850 gspca_dev->dev = dev; 1847 gspca_dev->dev = dev;
1851 gspca_dev->iface = interface->bInterfaceNumber; 1848 gspca_dev->iface = interface->bInterfaceNumber;
1852 gspca_dev->nbalt = intf->num_altsetting; 1849 gspca_dev->nbalt = intf->num_altsetting;
1853 gspca_dev->sd_desc = sd_desc; 1850 gspca_dev->sd_desc = sd_desc;
1854/* gspca_dev->users = 0; (done by kzalloc) */
1855 gspca_dev->nbufread = 2; 1851 gspca_dev->nbufread = 2;
1856 1852
1857 /* configure the subdriver and initialize the USB device */ 1853 /* configure the subdriver and initialize the USB device */