]> Git Repo - linux.git/commitdiff
drm: debugfs: make drm_debugfs_create_files() never fail
authorGreg Kroah-Hartman <[email protected]>
Fri, 14 Jun 2019 09:51:10 +0000 (11:51 +0200)
committerDaniel Vetter <[email protected]>
Fri, 14 Jun 2019 14:59:51 +0000 (16:59 +0200)
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 <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/drm_debugfs.c

index 63b9951bb8f3852cae7858d28849484d8579d504..eab0f2687cd6ea31c757eacb2ee4cf88974ee636 100644 (file)
@@ -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 drm_device *dev = minor->dev;
-       struct dentry *ent;
        struct drm_info_node *tmp;
-       int i, ret;
+       int i;
 
        for (i = 0; i < count; i++) {
                u32 features = files[i].driver_features;
@@ -188,22 +187,13 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
                        continue;
 
                tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
-               if (tmp == NULL) {
-                       ret = -1;
-                       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;
-               }
+               if (tmp == NULL)
+                       continue;
 
                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];
 
                mutex_lock(&minor->debugfs_lock);
@@ -211,10 +201,6 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
                mutex_unlock(&minor->debugfs_lock);
        }
        return 0;
-
-fail:
-       drm_debugfs_remove_files(files, count, minor);
-       return ret;
 }
 EXPORT_SYMBOL(drm_debugfs_create_files);
 
This page took 0.058873 seconds and 4 git commands to generate.