diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-02-19 04:41:40 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 15:11:09 -0300 |
commit | 10ee2402004d03b31555aad7badf7e499fa686d3 (patch) | |
tree | 3d12e11eeaaa9a96362a99de3e0fa6ca76399bc1 /drivers/media/video/gspca | |
parent | ac82f59f9cc6aae3300430fcc3422e59f83d89ae (diff) |
V4L/DVB: 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.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index d9a934b99a8..a156dd42bc4 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -184,8 +184,7 @@ static int gspca_input_connect(struct gspca_dev *dev) } else { dev->input_dev = input_dev; } - } else - err = -EINVAL; + } return err; } @@ -243,9 +242,8 @@ error: 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; @@ -259,12 +257,11 @@ static int gspca_input_create_urb(struct gspca_dev *gspca_dev) 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) @@ -2289,6 +2286,10 @@ int gspca_dev_probe(struct usb_interface *intf, 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); @@ -2310,12 +2311,12 @@ int gspca_dev_probe(struct usb_interface *intf, usb_set_intfdata(intf, gspca_dev); PDEBUG(D_PROBE, "%s created", video_device_node_name(&gspca_dev->vdev)); - ret = gspca_input_connect(gspca_dev); - if (ret == 0) - ret = gspca_input_create_urb(gspca_dev); + gspca_input_create_urb(gspca_dev); return 0; out: + if (gspca_dev->input_dev) + input_unregister_device(gspca_dev->input_dev); kfree(gspca_dev->usb_buf); kfree(gspca_dev); return ret; |