video/{ov511,stv680}: handle sysfs errors
PATCH 1/1 video/{ov511,stv680}: handle sysfs errors
Signed-off-by Jeff Garzik <[email protected]>
---
drivers/media/video/ov511.c | 58 +++++++++++++++++++++++++++++++++-------- drivers/media/video/stv680.c | 53 ++++++++++++++++++++++++++++++-------
drivers/media/video/ov511.c +47 -11
@@ -5648,17 +5648,49 @@ static ssize_t show_exposure(struct clas } static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); -static void ov_create_sysfs (struct video_device *vdev) +static int ov_create_sysfs (struct video_device *vdev) { -video_device_create_file (vdev, &class_device_attr_custom_id); -video_device_create_file (vdev, &class_device_attr_model); -video_device_create_file (vdev, &class_device_attr_bridge); -video_device_create_file (vdev, &class_device_attr_sensor); -video_device_create_file (vdev, &class_device_attr_brightness); -video_device_create_file (vdev, &class_device_attr_saturation); -video_device_create_file (vdev, &class_device_attr_contrast); -video_device_create_file (vdev, &class_device_attr_hue); -video_device_create_file (vdev, &class_device_attr_exposure); +int rc; + + rc =video_device_create_file (vdev, &class_device_attr_custom_id); +if (rc) goto err; + rc =video_device_create_file (vdev, &class_device_attr_model); +if (rc) goto err_id; + rc =video_device_create_file (vdev, &class_device_attr_bridge); +if (rc) goto err_model; + rc =video_device_create_file (vdev, &class_device_attr_sensor); +if (rc) goto err_bridge; + rc =video_device_create_file (vdev, &class_device_attr_brightness); +if (rc) goto err_sensor; + rc =video_device_create_file (vdev, &class_device_attr_saturation); +if (rc) goto err_bright; + rc =video_device_create_file (vdev, &class_device_attr_contrast); +if (rc) goto err_sat; + rc =video_device_create_file (vdev, &class_device_attr_hue); +if (rc) goto err_contrast; + rc =video_device_create_file (vdev, &class_device_attr_exposure); +if (rc) goto err_hue; + +return 0 ; + +err_hue: +video_device_remove_file (vdev, &class_device_attr_hue); +err_contrast: +video_device_remove_file (vdev, &class_device_attr_contrast); +err_sat: +video_device_remove_file (vdev, &class_device_attr_saturation); +err_bright: +video_device_remove_file (vdev, &class_device_attr_brightness); +err_sensor: +video_device_remove_file (vdev, &class_device_attr_sensor); +err_bridge: +video_device_remove_file (vdev, &class_device_attr_bridge); +err_model: +video_device_remove_file (vdev, &class_device_attr_model); +err_id: +video_device_remove_file (vdev, &class_device_attr_custom_id); +err: +return rc; }/****************************************************************************
@@ -5817,7 +5849,11 @@ #endif ov->vdev->minor);usb_set_intfdata (intf, ov); -ov_create_sysfs (ov->vdev); +if (ov_create_sysfs (ov->vdev)) { +err ("ov_create_sysfs failed" ); + goto error; + } +return 0 ; error:
drivers/media/video/stv680.c +43 -10
68 lines not on this page · raw message