Commit 8bc742e1 authored by David Howells's avatar David Howells Committed by Al Viro

drm: proc: Use remove_proc_subtree()

Use remove_proc_subtree() rather than remove_proc_entry() to remove a
minor-specific drm proc directory and all its children.

Things could theoretically be improved by storing the drm_minor pointer in the
minor-specific dir proc_dir_entry struct data and then scrapping the list of
proc files - but that's shared with the debugfs interface where you can't do
that, so I don't see an easy way of doing it.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: dri-devel@lists.freedesktop.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent b63e6aa5
...@@ -95,7 +95,7 @@ static int drm_proc_create_files(const struct drm_info_list *files, int count, ...@@ -95,7 +95,7 @@ static int drm_proc_create_files(const struct drm_info_list *files, int count,
struct drm_device *dev = minor->dev; struct drm_device *dev = minor->dev;
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
struct drm_info_node *tmp; struct drm_info_node *tmp;
int i, ret; int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
u32 features = files[i].driver_features; u32 features = files[i].driver_features;
...@@ -105,10 +105,9 @@ static int drm_proc_create_files(const struct drm_info_list *files, int count, ...@@ -105,10 +105,9 @@ static int drm_proc_create_files(const struct drm_info_list *files, int count,
continue; continue;
tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
if (tmp == NULL) { if (!tmp)
ret = -1; return -1;
goto fail;
}
tmp->minor = minor; tmp->minor = minor;
tmp->info_ent = &files[i]; tmp->info_ent = &files[i];
list_add(&tmp->list, &minor->proc_nodes.list); list_add(&tmp->list, &minor->proc_nodes.list);
...@@ -120,16 +119,10 @@ static int drm_proc_create_files(const struct drm_info_list *files, int count, ...@@ -120,16 +119,10 @@ static int drm_proc_create_files(const struct drm_info_list *files, int count,
minor->index, files[i].name); minor->index, files[i].name);
list_del(&tmp->list); list_del(&tmp->list);
kfree(tmp); kfree(tmp);
ret = -1; return -1;
goto fail;
} }
} }
return 0; return 0;
fail:
for (i = 0; i < count; i++)
remove_proc_entry(drm_proc_list[i].name, minor->proc_root);
return ret;
} }
/** /**
...@@ -160,7 +153,7 @@ int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root) ...@@ -160,7 +153,7 @@ int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root)
ret = drm_proc_create_files(drm_proc_list, DRM_PROC_ENTRIES, ret = drm_proc_create_files(drm_proc_list, DRM_PROC_ENTRIES,
minor->proc_root, minor); minor->proc_root, minor);
if (ret) { if (ret) {
remove_proc_entry(name, root); remove_proc_subtree(name, root);
minor->proc_root = NULL; minor->proc_root = NULL;
DRM_ERROR("Failed to create core drm proc files\n"); DRM_ERROR("Failed to create core drm proc files\n");
return ret; return ret;
...@@ -210,8 +203,7 @@ int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root) ...@@ -210,8 +203,7 @@ int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor); drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor);
sprintf(name, "%d", minor->index); sprintf(name, "%d", minor->index);
remove_proc_entry(name, root); remove_proc_subtree(name, root);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment