]> git.hungrycats.org Git - linux/commitdiff
media: pwc-if: must check vb2_queue_init() success
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 27 Oct 2012 17:26:25 +0000 (14:26 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Feb 2013 18:48:01 +0000 (10:48 -0800)
commit eda94710d6502672c5ee7de198fa78a63ddfae3a upstream.

drivers/media/usb/pwc/pwc-if.c: In function 'usb_pwc_probe':
drivers/media/usb/pwc/pwc-if.c:1003:16: warning: ignoring return value of 'vb2_queue_init', declared with attribute warn_unused_result [-Wunused-result]
In the past, it used to have a logic there at queue init that would
BUG() on errors. This logic got removed. Drivers are now required
to explicitly handle the queue initialization errors, or very bad
things may happen.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
drivers/media/usb/pwc/pwc-if.c

index 42e36bac4d72a93add64b485652fc957bf0a30a3..4d12397047aacd6ed5b72e3be1b16c6142c6fb7b 100644 (file)
@@ -1000,7 +1000,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
        pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf);
        pdev->vb_queue.ops = &pwc_vb_queue_ops;
        pdev->vb_queue.mem_ops = &vb2_vmalloc_memops;
-       vb2_queue_init(&pdev->vb_queue);
+       rc = vb2_queue_init(&pdev->vb_queue);
+       if (rc < 0) {
+               PWC_ERROR("Oops, could not initialize vb2 queue.\n");
+               goto err_free_mem;
+       }
 
        /* Init video_device structure */
        memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template));