aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/stv680.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/stv680.c')
-rw-r--r--drivers/media/video/stv680.c53
1 files changed, 43 insertions, 10 deletions
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: