Skip to contentSkip to conversation

drm/amdgpu: fix ras ctrl debugfs node leak

PATCH In review Chen, Guchun 2 participants 2 messages Sep 16, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix ras ctrl debugfs node leak

Use debugfs_remove_recursive to remove the whole debugfs directory instead of removing the node one by one.

Change-Id I27e9edab20d568b16d0163f8c7c3d81fb6832acd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 +++++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |  2 --
 2 files changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -7
index 5f06f1e645c7..0a90e5cb3ca4 100644
@@ -978,10 +978,10 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
 	struct drm_minor *minor = adev->ddev->primary;
 
 	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);
-	con->ent = debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,
-					       adev, &amdgpu_ras_debugfs_eeprom_ops);
+	debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir,
+				adev, &amdgpu_ras_debugfs_ctrl_ops);
+	debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,
+				adev, &amdgpu_ras_debugfs_eeprom_ops);
 }
 
 void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
@@ -1026,10 +1026,8 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
 		amdgpu_ras_debugfs_remove(adev, &obj->head);
 	}
 
-	debugfs_remove(con->ent);
-	debugfs_remove(con->dir);
+	debugfs_remove_recursive(con->dir);
 	con->dir = NULL;
-	con->ent = NULL;
 }
 /* debugfs end */
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -2
index dd5da3c6327e..ae386c466c0e 100644
@@ -317,8 +317,6 @@ struct amdgpu_ras {
 	struct list_head head;
 	/* debugfs */
 	struct dentry *dir;
-	/* debugfs ctrl */
-	struct dentry *ent;
 	/* sysfs */
 	struct device_attribute features_attr;
 	struct bin_attribute badpages_attr;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw

Am 16.09.19 um 07:47 schrieb Chen, Guchun:

Quoted 5 lines

Use debugfs_remove_recursive to remove the whole debugfs directory instead of removing the node one by one.

Change-Id I27e9edab20d568b16d0163f8c7c3d81fb6832acd
Quoted 41 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 +++++-------
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |  2 --
  2 files changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -7
index 5f06f1e645c7..0a90e5cb3ca4 100644
@@ -978,10 +978,10 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
  	struct drm_minor *minor = adev->ddev->primary;
 
  	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);
-	con->ent = debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,
-					       adev, &amdgpu_ras_debugfs_eeprom_ops);
+	debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir,
+				adev, &amdgpu_ras_debugfs_ctrl_ops);
+	debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,
+				adev, &amdgpu_ras_debugfs_eeprom_ops);
  }
 
  void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
@@ -1026,10 +1026,8 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
  		amdgpu_ras_debugfs_remove(adev, &obj->head);
  	}
 
-	debugfs_remove(con->ent);
-	debugfs_remove(con->dir);
+	debugfs_remove_recursive(con->dir);
  	con->dir = NULL;
-	con->ent = NULL;
  }
  /* debugfs end */
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -0
index dd5da3c6327e..ae386c466c0e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h struct amdgpu_ras { · line 322

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -2
@@ -317,8 +317,6 @@ struct amdgpu_ras {
  	struct list_head head;
  	/* debugfs */
  	struct dentry *dir;
-	/* debugfs ctrl */
-	struct dentry *ent;
  	/* sysfs */
  	struct device_attribute features_attr;
  	struct bin_attribute badpages_attr;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx