Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 190576
b: refs/heads/master
c: a1c4560
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Dave Airlie committed Apr 28, 2010
1 parent 7c3818f commit 7c20b1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0031c41be5c529f8329e327b63cde92ba1284842
refs/heads/master: a1c4560d4d8909cc4feb6f9e875d0b92083e05cf
21 changes: 12 additions & 9 deletions trunk/drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ static struct bin_attribute edid_attr = {
int drm_sysfs_connector_add(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
int ret = 0, i, j;
int attr_cnt = 0;
int opt_cnt = 0;
int i;
int ret = 0;

/* We shouldn't get called more than once for the same connector */
BUG_ON(device_is_registered(&connector->kdev));
Expand All @@ -376,8 +379,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)

/* Standard attributes */

for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) {
ret = device_create_file(&connector->kdev, &connector_attrs[i]);
for (attr_cnt = 0; attr_cnt < ARRAY_SIZE(connector_attrs); attr_cnt++) {
ret = device_create_file(&connector->kdev, &connector_attrs[attr_cnt]);
if (ret)
goto err_out_files;
}
Expand All @@ -393,8 +396,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
case DRM_MODE_CONNECTOR_SVIDEO:
case DRM_MODE_CONNECTOR_Component:
case DRM_MODE_CONNECTOR_TV:
for (i = 0; i < ARRAY_SIZE(connector_attrs_opt1); i++) {
ret = device_create_file(&connector->kdev, &connector_attrs_opt1[i]);
for (opt_cnt = 0; opt_cnt < ARRAY_SIZE(connector_attrs_opt1); opt_cnt++) {
ret = device_create_file(&connector->kdev, &connector_attrs_opt1[opt_cnt]);
if (ret)
goto err_out_files;
}
Expand All @@ -413,10 +416,10 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
return 0;

err_out_files:
if (i > 0)
for (j = 0; j < i; j++)
device_remove_file(&connector->kdev,
&connector_attrs[i]);
for (i = 0; i < opt_cnt; i++)
device_remove_file(&connector->kdev, &connector_attrs_opt1[i]);
for (i = 0; i < attr_cnt; i++)
device_remove_file(&connector->kdev, &connector_attrs[i]);
device_unregister(&connector->kdev);

out:
Expand Down

0 comments on commit 7c20b1b

Please sign in to comment.