aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-02-19 02:41:40 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:11:09 -0500
commit10ee2402004d03b31555aad7badf7e499fa686d3 (patch)
tree3d12e11eeaaa9a96362a99de3e0fa6ca76399bc1 /drivers/media
parentac82f59f9cc6aae3300430fcc3422e59f83d89ae (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')
-rw-r--r--drivers/media/video/gspca/gspca.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index d9a934b99a89..a156dd42bc40 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)
184 } else { 184 } else {
185 dev->input_dev = input_dev; 185 dev->input_dev = input_dev;
186 } 186 }
187 } else 187 }
188 err = -EINVAL;
189 188
190 return err; 189 return err;
191} 190}
@@ -243,9 +242,8 @@ error:
243 return ret; 242 return ret;
244} 243}
245 244
246static int gspca_input_create_urb(struct gspca_dev *gspca_dev) 245static void gspca_input_create_urb(struct gspca_dev *gspca_dev)
247{ 246{
248 int ret = -EINVAL;
249 struct usb_interface *intf; 247 struct usb_interface *intf;
250 struct usb_host_interface *intf_desc; 248 struct usb_host_interface *intf_desc;
251 struct usb_endpoint_descriptor *ep; 249 struct usb_endpoint_descriptor *ep;
@@ -259,12 +257,11 @@ static int gspca_input_create_urb(struct gspca_dev *gspca_dev)
259 if (usb_endpoint_dir_in(ep) && 257 if (usb_endpoint_dir_in(ep) &&
260 usb_endpoint_xfer_int(ep)) { 258 usb_endpoint_xfer_int(ep)) {
261 259
262 ret = alloc_and_submit_int_urb(gspca_dev, ep); 260 alloc_and_submit_int_urb(gspca_dev, ep);
263 break; 261 break;
264 } 262 }
265 } 263 }
266 } 264 }
267 return ret;
268} 265}
269 266
270static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev) 267static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev)
@@ -2289,6 +2286,10 @@ int gspca_dev_probe(struct usb_interface *intf,
2289 goto out; 2286 goto out;
2290 gspca_set_default_mode(gspca_dev); 2287 gspca_set_default_mode(gspca_dev);
2291 2288
2289 ret = gspca_input_connect(gspca_dev);
2290 if (ret)
2291 goto out;
2292
2292 mutex_init(&gspca_dev->usb_lock); 2293 mutex_init(&gspca_dev->usb_lock);
2293 mutex_init(&gspca_dev->read_lock); 2294 mutex_init(&gspca_dev->read_lock);
2294 mutex_init(&gspca_dev->queue_lock); 2295 mutex_init(&gspca_dev->queue_lock);
@@ -2310,12 +2311,12 @@ int gspca_dev_probe(struct usb_interface *intf,
2310 usb_set_intfdata(intf, gspca_dev); 2311 usb_set_intfdata(intf, gspca_dev);
2311 PDEBUG(D_PROBE, "%s created", video_device_node_name(&gspca_dev->vdev)); 2312 PDEBUG(D_PROBE, "%s created", video_device_node_name(&gspca_dev->vdev));
2312 2313
2313 ret = gspca_input_connect(gspca_dev); 2314 gspca_input_create_urb(gspca_dev);
2314 if (ret == 0)
2315 ret = gspca_input_create_urb(gspca_dev);
2316 2315
2317 return 0; 2316 return 0;
2318out: 2317out:
2318 if (gspca_dev->input_dev)
2319 input_unregister_device(gspca_dev->input_dev);
2319 kfree(gspca_dev->usb_buf); 2320 kfree(gspca_dev->usb_buf);
2320 kfree(gspca_dev); 2321 kfree(gspca_dev);
2321 return ret; 2322 return ret;