diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-10 14:09:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-10-13 23:44:13 -0400 |
commit | 2444a2fca488fa8e362895a4ca9fdc51f497282a (patch) | |
tree | 05e4bcdc628f9825da6f027cb506728ad3649957 /drivers/media/video/stv680.c | |
parent | 474ce78130ba37cb50e620c538ab3ffe6c582ba6 (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>
Diffstat (limited to 'drivers/media/video/stv680.c')
-rw-r--r-- | drivers/media/video/stv680.c | 53 |
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"); | |||
516 | stv680_file(packets_dropped, dropped, "%d\n"); | 516 | stv680_file(packets_dropped, dropped, "%d\n"); |
517 | stv680_file(decoding_errors, error, "%d\n"); | 517 | stv680_file(decoding_errors, error, "%d\n"); |
518 | 518 | ||
519 | static void stv680_create_sysfs_files(struct video_device *vdev) | 519 | static 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 | |||
542 | err_dropped: | ||
543 | video_device_remove_file(vdev, &class_device_attr_packets_dropped); | ||
544 | err_framread: | ||
545 | video_device_remove_file(vdev, &class_device_attr_frames_read); | ||
546 | err_framtot: | ||
547 | video_device_remove_file(vdev, &class_device_attr_frames_total); | ||
548 | err_pal: | ||
549 | video_device_remove_file(vdev, &class_device_attr_palette); | ||
550 | err_stream: | ||
551 | video_device_remove_file(vdev, &class_device_attr_streaming); | ||
552 | err_inuse: | ||
553 | video_device_remove_file(vdev, &class_device_attr_in_use); | ||
554 | err_model: | ||
555 | video_device_remove_file(vdev, &class_device_attr_model); | ||
556 | err: | ||
557 | return rc; | ||
529 | } | 558 | } |
530 | 559 | ||
531 | static void stv680_remove_sysfs_files(struct video_device *vdev) | 560 | static 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 | ||
1455 | error_unreg: | ||
1456 | video_unregister_device(stv680->vdev); | ||
1424 | error_vdev: | 1457 | error_vdev: |
1425 | video_device_release(stv680->vdev); | 1458 | video_device_release(stv680->vdev); |
1426 | error: | 1459 | error: |