The patch number 14385 was added via Douglas Schilling Landgraf <dougsl...@redhat.com> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: Linux Media Mailing List <linux-me...@vger.kernel.org> ------ From: Hans de Goede <hdego...@redhat.com> gspca_main: some input error handling fixes 2 small changes to input device error handling: 1) Make it fatal when we fail to create an input device (it is either this or add checks for gspca_dev->input_dev being NULL in a lot of places) 2) Since we allow gspca_input_create_urb() to fail everywhere we call it, and thus never check its return value, make it void. Priority: normal Signed-off-by: Hans de Goede <hdego...@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com> Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com> --- linux/drivers/media/video/gspca/gspca.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff -r 3dd46f8eee55 -r b2c1397f1fb0 linux/drivers/media/video/gspca/gspca.c --- a/linux/drivers/media/video/gspca/gspca.c Thu Mar 04 00:40:46 2010 -0300 +++ b/linux/drivers/media/video/gspca/gspca.c Thu Mar 04 02:36:22 2010 -0300 @@ -203,8 +203,7 @@ } else { dev->input_dev = input_dev; } - } else - err = -EINVAL; + } return err; } @@ -262,9 +261,8 @@ return ret; } -static int gspca_input_create_urb(struct gspca_dev *gspca_dev) +static void gspca_input_create_urb(struct gspca_dev *gspca_dev) { - int ret = -EINVAL; struct usb_interface *intf; struct usb_host_interface *intf_desc; struct usb_endpoint_descriptor *ep; @@ -278,12 +276,11 @@ if (usb_endpoint_dir_in(ep) && usb_endpoint_xfer_int(ep)) { - ret = alloc_and_submit_int_urb(gspca_dev, ep); + alloc_and_submit_int_urb(gspca_dev, ep); break; } } } - return ret; } static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev) @@ -2329,6 +2326,10 @@ goto out; gspca_set_default_mode(gspca_dev); + ret = gspca_input_connect(gspca_dev); + if (ret) + goto out; + mutex_init(&gspca_dev->usb_lock); mutex_init(&gspca_dev->read_lock); mutex_init(&gspca_dev->queue_lock); @@ -2351,13 +2352,15 @@ PDEBUG(D_PROBE, "%s created", video_device_node_name(&gspca_dev->vdev)); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) - ret = gspca_input_connect(gspca_dev); - if (ret == 0) - ret = gspca_input_create_urb(gspca_dev); + gspca_input_create_urb(gspca_dev); #endif return 0; out: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) + if (gspca_dev->input_dev) + input_unregister_device(gspca_dev->input_dev); +#endif kfree(gspca_dev->usb_buf); kfree(gspca_dev); return ret; --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/b2c1397f1fb0423ce3588f18c35d27abff502ef6 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits