aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-10 14:09:43 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-13 23:44:13 -0400
commit2444a2fca488fa8e362895a4ca9fdc51f497282a (patch)
tree05e4bcdc628f9825da6f027cb506728ad3649957
parent474ce78130ba37cb50e620c538ab3ffe6c582ba6 (diff)
V4L/DVB (4741): {ov511,stv680}: handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/ov511.c58
-rw-r--r--drivers/media/video/stv680.c53
2 files changed, 90 insertions, 21 deletions
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index ce4886f1528d..b4db2cbb5a84 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -5648,17 +5648,49 @@ static ssize_t show_exposure(struct class_device *cd, char *buf)
5648} 5648}
5649static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); 5649static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);
5650 5650
5651static void ov_create_sysfs(struct video_device *vdev) 5651static int ov_create_sysfs(struct video_device *vdev)
5652{ 5652{
5653 video_device_create_file(vdev, &class_device_attr_custom_id); 5653 int rc;
5654 video_device_create_file(vdev, &class_device_attr_model); 5654
5655 video_device_create_file(vdev, &class_device_attr_bridge); 5655 rc = video_device_create_file(vdev, &class_device_attr_custom_id);
5656 video_device_create_file(vdev, &class_device_attr_sensor); 5656 if (rc) goto err;
5657 video_device_create_file(vdev, &class_device_attr_brightness); 5657 rc = video_device_create_file(vdev, &class_device_attr_model);
5658 video_device_create_file(vdev, &class_device_attr_saturation); 5658 if (rc) goto err_id;
5659 video_device_create_file(vdev, &class_device_attr_contrast); 5659 rc = video_device_create_file(vdev, &class_device_attr_bridge);
5660 video_device_create_file(vdev, &class_device_attr_hue); 5660 if (rc) goto err_model;
5661 video_device_create_file(vdev, &class_device_attr_exposure); 5661 rc = video_device_create_file(vdev, &class_device_attr_sensor);
5662 if (rc) goto err_bridge;
5663 rc = video_device_create_file(vdev, &class_device_attr_brightness);
5664 if (rc) goto err_sensor;
5665 rc = video_device_create_file(vdev, &class_device_attr_saturation);
5666 if (rc) goto err_bright;
5667 rc = video_device_create_file(vdev, &class_device_attr_contrast);
5668 if (rc) goto err_sat;
5669 rc = video_device_create_file(vdev, &class_device_attr_hue);
5670 if (rc) goto err_contrast;
5671 rc = video_device_create_file(vdev, &class_device_attr_exposure);
5672 if (rc) goto err_hue;
5673
5674 return 0;
5675
5676err_hue:
5677 video_device_remove_file(vdev, &class_device_attr_hue);
5678err_contrast:
5679 video_device_remove_file(vdev, &class_device_attr_contrast);
5680err_sat:
5681 video_device_remove_file(vdev, &class_device_attr_saturation);
5682err_bright:
5683 video_device_remove_file(vdev, &class_device_attr_brightness);
5684err_sensor:
5685 video_device_remove_file(vdev, &class_device_attr_sensor);
5686err_bridge:
5687 video_device_remove_file(vdev, &class_device_attr_bridge);
5688err_model:
5689 video_device_remove_file(vdev, &class_device_attr_model);
5690err_id:
5691 video_device_remove_file(vdev, &class_device_attr_custom_id);
5692err:
5693 return rc;
5662} 5694}
5663 5695
5664/**************************************************************************** 5696/****************************************************************************
@@ -5817,7 +5849,11 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
5817 ov->vdev->minor); 5849 ov->vdev->minor);
5818 5850
5819 usb_set_intfdata(intf, ov); 5851 usb_set_intfdata(intf, ov);
5820 ov_create_sysfs(ov->vdev); 5852 if (ov_create_sysfs(ov->vdev)) {
5853 err("ov_create_sysfs failed");
5854 goto error;
5855 }
5856
5821 return 0; 5857 return 0;
5822 5858
5823error: 5859error:
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c
index 87e11300181d..6d1ef1e2e8ef 100644
--- a/drivers/media/video/stv680.c
+++ b/drivers/media/video/stv680.c
@@ -516,16 +516,45 @@ stv680_file(frames_read, framecount, "%d\n");
516stv680_file(packets_dropped, dropped, "%d\n"); 516stv680_file(packets_dropped, dropped, "%d\n");
517stv680_file(decoding_errors, error, "%d\n"); 517stv680_file(decoding_errors, error, "%d\n");
518 518
519static void stv680_create_sysfs_files(struct video_device *vdev) 519static int stv680_create_sysfs_files(struct video_device *vdev)
520{ 520{
521 video_device_create_file(vdev, &class_device_attr_model); 521 int rc;
522 video_device_create_file(vdev, &class_device_attr_in_use); 522
523 video_device_create_file(vdev, &class_device_attr_streaming); 523 rc = video_device_create_file(vdev, &class_device_attr_model);
524 video_device_create_file(vdev, &class_device_attr_palette); 524 if (rc) goto err;
525 video_device_create_file(vdev, &class_device_attr_frames_total); 525 rc = video_device_create_file(vdev, &class_device_attr_in_use);
526 video_device_create_file(vdev, &class_device_attr_frames_read); 526 if (rc) goto err_model;
527 video_device_create_file(vdev, &class_device_attr_packets_dropped); 527 rc = video_device_create_file(vdev, &class_device_attr_streaming);
528 video_device_create_file(vdev, &class_device_attr_decoding_errors); 528 if (rc) goto err_inuse;
529 rc = video_device_create_file(vdev, &class_device_attr_palette);
530 if (rc) goto err_stream;
531 rc = video_device_create_file(vdev, &class_device_attr_frames_total);
532 if (rc) goto err_pal;
533 rc = video_device_create_file(vdev, &class_device_attr_frames_read);
534 if (rc) goto err_framtot;
535 rc = video_device_create_file(vdev, &class_device_attr_packets_dropped);
536 if (rc) goto err_framread;
537 rc = video_device_create_file(vdev, &class_device_attr_decoding_errors);
538 if (rc) goto err_dropped;
539
540 return 0;
541
542err_dropped:
543 video_device_remove_file(vdev, &class_device_attr_packets_dropped);
544err_framread:
545 video_device_remove_file(vdev, &class_device_attr_frames_read);
546err_framtot:
547 video_device_remove_file(vdev, &class_device_attr_frames_total);
548err_pal:
549 video_device_remove_file(vdev, &class_device_attr_palette);
550err_stream:
551 video_device_remove_file(vdev, &class_device_attr_streaming);
552err_inuse:
553 video_device_remove_file(vdev, &class_device_attr_in_use);
554err_model:
555 video_device_remove_file(vdev, &class_device_attr_model);
556err:
557 return rc;
529} 558}
530 559
531static void stv680_remove_sysfs_files(struct video_device *vdev) 560static void stv680_remove_sysfs_files(struct video_device *vdev)
@@ -1418,9 +1447,13 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
1418 PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev->minor); 1447 PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev->minor);
1419 1448
1420 usb_set_intfdata (intf, stv680); 1449 usb_set_intfdata (intf, stv680);
1421 stv680_create_sysfs_files(stv680->vdev); 1450 retval = stv680_create_sysfs_files(stv680->vdev);
1451 if (retval)
1452 goto error_unreg;
1422 return 0; 1453 return 0;
1423 1454
1455error_unreg:
1456 video_unregister_device(stv680->vdev);
1424error_vdev: 1457error_vdev:
1425 video_device_release(stv680->vdev); 1458 video_device_release(stv680->vdev);
1426error: 1459error: