Commit 987d65d0 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Daniel Vetter

drm: debugfs: make drm_debugfs_create_files() never fail

As stated before, there is no need to care if a debugfs function
succeeds or not, and no code logic in the kernel should ever change
based on a debugfs function return value, so make
drm_debugfs_create_files() never fail.  If it encounters an
odd/rare/impossible error (i.e. out of memory, or a duplicate debugfs
filename to be created), just keep on moving as if nothing improper had
happened.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614095110.3716-2-gregkh@linuxfoundation.org
parent de85ec27
...@@ -176,9 +176,8 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count, ...@@ -176,9 +176,8 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
struct dentry *root, struct drm_minor *minor) struct dentry *root, struct drm_minor *minor)
{ {
struct drm_device *dev = minor->dev; struct drm_device *dev = minor->dev;
struct dentry *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;
...@@ -188,22 +187,13 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count, ...@@ -188,22 +187,13 @@ int drm_debugfs_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 == NULL)
ret = -1; continue;
goto fail;
}
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
root, tmp, &drm_debugfs_fops);
if (!ent) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/%s\n",
root, files[i].name);
kfree(tmp);
ret = -1;
goto fail;
}
tmp->minor = minor; tmp->minor = minor;
tmp->dent = ent; tmp->dent = debugfs_create_file(files[i].name,
S_IFREG | S_IRUGO, root, tmp,
&drm_debugfs_fops);
tmp->info_ent = &files[i]; tmp->info_ent = &files[i];
mutex_lock(&minor->debugfs_lock); mutex_lock(&minor->debugfs_lock);
...@@ -211,10 +201,6 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count, ...@@ -211,10 +201,6 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
mutex_unlock(&minor->debugfs_lock); mutex_unlock(&minor->debugfs_lock);
} }
return 0; return 0;
fail:
drm_debugfs_remove_files(files, count, minor);
return ret;
} }
EXPORT_SYMBOL(drm_debugfs_create_files); EXPORT_SYMBOL(drm_debugfs_create_files);
......
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