AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu:  use IS_ERR for debugfs APIs
@ 2021-09-02 11:44 Nirmoy Das
  2021-09-02 11:44 ` [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings Nirmoy Das
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Nirmoy Das @ 2021-09-02 11:44 UTC (permalink / raw)
  To: amd-gfx; +Cc: Christian.Koenig, Nirmoy Das

debugfs APIs returns encoded error so use
IS_ERR for checking return value.

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 ++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index d256215ab2c7..077f9baf74fe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1696,18 +1696,16 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	struct dentry *ent;
 	int r, i;
 
-
-
 	ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
 				  &fops_ib_preempt);
-	if (!ent) {
+	if (IS_ERR(ent)) {
 		DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
 		return -EIO;
 	}
 
 	ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev,
 				  &fops_sclk_set);
-	if (!ent) {
+	if (IS_ERR(ent)) {
 		DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
 		return -EIO;
 	}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 7b634a1517f9..f40753e1a60d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -428,7 +428,7 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
 	ent = debugfs_create_file(name,
 				  S_IFREG | S_IRUGO, root,
 				  ring, &amdgpu_debugfs_ring_fops);
-	if (!ent)
+	if (IS_ERR(ent))
 		return -ENOMEM;
 
 	i_size_write(ent->d_inode, ring->ring_size + 12);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH v2 1/2] drm/amdgpu:  use IS_ERR for debugfs APIs
@ 2021-09-02 13:43 Nirmoy Das
  2021-09-02 13:43 ` [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings Nirmoy Das
  0 siblings, 1 reply; 17+ messages in thread
From: Nirmoy Das @ 2021-09-02 13:43 UTC (permalink / raw)
  To: amd-gfx; +Cc: Christian.Koenig, Nirmoy Das

debugfs APIs returns encoded error so use
IS_ERR for checking return value.

v2: return PTR_ERR(ent)

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    |  4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index d256215ab2c7..60f46a4b0144 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1696,20 +1696,18 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	struct dentry *ent;
 	int r, i;

-
-
 	ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
 				  &fops_ib_preempt);
-	if (!ent) {
+	if (IS_ERR(ent)) {
 		DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
-		return -EIO;
+		return PTR_ERR(ent);
 	}

 	ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev,
 				  &fops_sclk_set);
-	if (!ent) {
+	if (IS_ERR(ent)) {
 		DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
-		return -EIO;
+		return PTR_ERR(ent);
 	}

 	/* Register debugfs entries for amdgpu_ttm */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 7b634a1517f9..0554576d3695 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -428,8 +428,8 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
 	ent = debugfs_create_file(name,
 				  S_IFREG | S_IRUGO, root,
 				  ring, &amdgpu_debugfs_ring_fops);
-	if (!ent)
-		return -ENOMEM;
+	if (IS_ERR(ent))
+		return PTR_ERR(ent);

 	i_size_write(ent->d_inode, ring->ring_size + 12);
 	ring->ent = ent;
--
2.32.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-09-08  8:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-02 11:44 [PATCH 1/2] drm/amdgpu: use IS_ERR for debugfs APIs Nirmoy Das
2021-09-02 11:44 ` [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings Nirmoy Das
2021-09-03  6:36   ` Sharma, Shashank
2021-09-03  8:09     ` Das, Nirmoy
2021-09-03 15:26       ` Sharma, Shashank
2021-09-03 15:51         ` Das, Nirmoy
2021-09-03 16:14           ` Das, Nirmoy
2021-09-05  8:03             ` Sharma, Shashank
2021-09-05 11:31               ` Das, Nirmoy
2021-09-06 16:45                 ` Sharma, Shashank
2021-09-08  8:54                   ` Das, Nirmoy
2021-09-02 15:23 ` [PATCH 1/2] drm/amdgpu: use IS_ERR for debugfs APIs Sharma, Shashank
2021-09-03  7:53 ` Christian König
2021-09-03  8:13   ` Das, Nirmoy
2021-09-03  8:17     ` Christian König
2021-09-03 15:28       ` Sharma, Shashank
  -- strict thread matches above, loose matches on Subject: below --
2021-09-02 13:43 [PATCH v2 " Nirmoy Das
2021-09-02 13:43 ` [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings Nirmoy Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox