aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/et61x251
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-13 06:17:32 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-13 23:44:17 -0400
commitc12e3be0860652ed1e15c9442adcba44317211d1 (patch)
treebce864340c0f854b3b05339eaf2953147fe9baae /drivers/media/video/et61x251
parent2444a2fca488fa8e362895a4ca9fdc51f497282a (diff)
V4L/DVB (4742): Drivers/media/video: handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/et61x251')
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index bc544cc7ccb8..f786ab11d2cd 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -973,16 +973,32 @@ static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
973 et61x251_show_i2c_val, et61x251_store_i2c_val); 973 et61x251_show_i2c_val, et61x251_store_i2c_val);
974 974
975 975
976static void et61x251_create_sysfs(struct et61x251_device* cam) 976static int et61x251_create_sysfs(struct et61x251_device* cam)
977{ 977{
978 struct video_device *v4ldev = cam->v4ldev; 978 struct video_device *v4ldev = cam->v4ldev;
979 int rc;
979 980
980 video_device_create_file(v4ldev, &class_device_attr_reg); 981 rc = video_device_create_file(v4ldev, &class_device_attr_reg);
981 video_device_create_file(v4ldev, &class_device_attr_val); 982 if (rc) goto err;
983 rc = video_device_create_file(v4ldev, &class_device_attr_val);
984 if (rc) goto err_reg;
982 if (cam->sensor.sysfs_ops) { 985 if (cam->sensor.sysfs_ops) {
983 video_device_create_file(v4ldev, &class_device_attr_i2c_reg); 986 rc = video_device_create_file(v4ldev, &class_device_attr_i2c_reg);
984 video_device_create_file(v4ldev, &class_device_attr_i2c_val); 987 if (rc) goto err_val;
988 rc = video_device_create_file(v4ldev, &class_device_attr_i2c_val);
989 if (rc) goto err_i2c_reg;
985 } 990 }
991
992 return 0;
993
994err_i2c_reg:
995 video_device_remove_file(v4ldev, &class_device_attr_i2c_reg);
996err_val:
997 video_device_remove_file(v4ldev, &class_device_attr_val);
998err_reg:
999 video_device_remove_file(v4ldev, &class_device_attr_reg);
1000err:
1001 return rc;
986} 1002}
987#endif /* CONFIG_VIDEO_ADV_DEBUG */ 1003#endif /* CONFIG_VIDEO_ADV_DEBUG */
988 1004
@@ -2534,7 +2550,9 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
2534 dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; 2550 dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0;
2535 2551
2536#ifdef CONFIG_VIDEO_ADV_DEBUG 2552#ifdef CONFIG_VIDEO_ADV_DEBUG
2537 et61x251_create_sysfs(cam); 2553 err = et61x251_create_sysfs(cam);
2554 if (err)
2555 goto fail2;
2538 DBG(2, "Optional device control through 'sysfs' interface ready"); 2556 DBG(2, "Optional device control through 'sysfs' interface ready");
2539#endif 2557#endif
2540 2558
@@ -2544,6 +2562,13 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
2544 2562
2545 return 0; 2563 return 0;
2546 2564
2565#ifdef CONFIG_VIDEO_ADV_DEBUG
2566fail2:
2567 video_nr[dev_nr] = -1;
2568 dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0;
2569 mutex_unlock(&cam->dev_mutex);
2570 video_unregister_device(cam->v4ldev);
2571#endif
2547fail: 2572fail:
2548 if (cam) { 2573 if (cam) {
2549 kfree(cam->control_buffer); 2574 kfree(cam->control_buffer);