amdgpu: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Jun 2019 13:19:19 +0000 (15:19 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 13 Jun 2019 18:59:49 +0000 (13:59 -0500)
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: xinhui pan <xinhui.pan@amd.com>
Cc: Evan Quan <evan.quan@amd.com>
Cc: Feifei Xu <Feifei.Xu@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

index 011630f62f8504660daadd5645074fe4037e5698..7efc4e07665d0b8963cdf0bd56fbb68400cdc453 100644 (file)
@@ -967,40 +967,24 @@ static int amdgpu_ras_sysfs_remove_all(struct amdgpu_device *adev)
 /* sysfs end */
 
 /* debugfs begin */
-static int amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
+static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
 {
        struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
        struct drm_minor *minor = adev->ddev->primary;
-       struct dentry *root = minor->debugfs_root, *dir;
-       struct dentry *ent;
-
-       dir = debugfs_create_dir("ras", root);
-       if (IS_ERR(dir))
-               return -EINVAL;
 
-       con->dir = dir;
-
-       ent = debugfs_create_file("ras_ctrl",
-                       S_IWUGO | S_IRUGO, con->dir,
-                       adev, &amdgpu_ras_debugfs_ctrl_ops);
-       if (IS_ERR(ent)) {
-               debugfs_remove(con->dir);
-               return -EINVAL;
-       }
-
-       con->ent = ent;
-       return 0;
+       con->dir = debugfs_create_dir("ras", minor->debugfs_root);
+       con->ent = debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir,
+                                      adev, &amdgpu_ras_debugfs_ctrl_ops);
 }
 
-int amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
+void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
                struct ras_fs_if *head)
 {
        struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
        struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head->head);
-       struct dentry *ent;
 
        if (!obj || obj->ent)
-               return -EINVAL;
+               return;
 
        get_obj(obj);
 
@@ -1008,34 +992,25 @@ int amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
                        head->debugfs_name,
                        sizeof(obj->fs_data.debugfs_name));
 
-       ent = debugfs_create_file(obj->fs_data.debugfs_name,
-                       S_IWUGO | S_IRUGO, con->dir,
-                       obj, &amdgpu_ras_debugfs_ops);
-
-       if (IS_ERR(ent))
-               return -EINVAL;
-
-       obj->ent = ent;
-
-       return 0;
+       obj->ent = debugfs_create_file(obj->fs_data.debugfs_name,
+                                      S_IWUGO | S_IRUGO, con->dir, obj,
+                                      &amdgpu_ras_debugfs_ops);
 }
 
-int amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
+void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
                struct ras_common_if *head)
 {
        struct ras_manager *obj = amdgpu_ras_find_obj(adev, head);
 
        if (!obj || !obj->ent)
-               return 0;
+               return;
 
        debugfs_remove(obj->ent);
        obj->ent = NULL;
        put_obj(obj);
-
-       return 0;
 }
 
-static int amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
+static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
 {
        struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
        struct ras_manager *obj, *tmp;
@@ -1048,8 +1023,6 @@ static int amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
        debugfs_remove(con->dir);
        con->dir = NULL;
        con->ent = NULL;
-
-       return 0;
 }
 /* debugfs end */
 
index 94c652f5265a545e23e85419e7e4a19c4db3556b..b2841195bd3bbae0d0763d2370cc15c9ddaf9a99 100644 (file)
@@ -276,10 +276,10 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
 int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
                struct ras_common_if *head);
 
-int amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
+void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
                struct ras_fs_if *head);
 
-int amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
+void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
                struct ras_common_if *head);
 
 int amdgpu_ras_error_query(struct amdgpu_device *adev,
index ba36a28da2fae00b1e1a330063ef391a402f7b6a..a3f1490f7307e6ae0bfab78f1d6f68fa930f1a9a 100644 (file)
@@ -3904,9 +3904,7 @@ static int gfx_v9_0_ecc_late_init(void *handle)
        if (r)
                goto interrupt;
 
-       r = amdgpu_ras_debugfs_create(adev, &fs_info);
-       if (r)
-               goto debugfs;
+       amdgpu_ras_debugfs_create(adev, &fs_info);
 
        r = amdgpu_ras_sysfs_create(adev, &fs_info);
        if (r)
@@ -3921,7 +3919,6 @@ irq:
        amdgpu_ras_sysfs_remove(adev, *ras_if);
 sysfs:
        amdgpu_ras_debugfs_remove(adev, *ras_if);
-debugfs:
        amdgpu_ras_interrupt_remove_handler(adev, &ih_info);
 interrupt:
        amdgpu_ras_feature_enable(adev, *ras_if, 0);
index 602593bab7a7b60750de287f21e1edb7f98c53d6..3c23de4b2e48db0b11c06a84edafc36eaa79a932 100644 (file)
@@ -730,9 +730,7 @@ static int gmc_v9_0_ecc_late_init(void *handle)
        if (r)
                goto interrupt;
 
-       r = amdgpu_ras_debugfs_create(adev, &fs_info);
-       if (r)
-               goto debugfs;
+       amdgpu_ras_debugfs_create(adev, &fs_info);
 
        r = amdgpu_ras_sysfs_create(adev, &fs_info);
        if (r)
@@ -747,7 +745,6 @@ irq:
        amdgpu_ras_sysfs_remove(adev, *ras_if);
 sysfs:
        amdgpu_ras_debugfs_remove(adev, *ras_if);
-debugfs:
        amdgpu_ras_interrupt_remove_handler(adev, &ih_info);
 interrupt:
        amdgpu_ras_feature_enable(adev, *ras_if, 0);
index 7a259c5b6c62d4f0cc8f0db0e2f03612bd4a4ace..c0b6011b4bd1c1c7e67a6e67b13b66d0cdc4f32d 100644 (file)
@@ -1566,9 +1566,7 @@ static int sdma_v4_0_late_init(void *handle)
        if (r)
                goto interrupt;
 
-       r = amdgpu_ras_debugfs_create(adev, &fs_info);
-       if (r)
-               goto debugfs;
+       amdgpu_ras_debugfs_create(adev, &fs_info);
 
        r = amdgpu_ras_sysfs_create(adev, &fs_info);
        if (r)
@@ -1589,7 +1587,6 @@ irq:
        amdgpu_ras_sysfs_remove(adev, *ras_if);
 sysfs:
        amdgpu_ras_debugfs_remove(adev, *ras_if);
-debugfs:
        amdgpu_ras_interrupt_remove_handler(adev, &ih_info);
 interrupt:
        amdgpu_ras_feature_enable(adev, *ras_if, 0);