Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446376 > unrolled thread

[PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init()

Started byWei Yongjun <weiyj_lk@163.com>
First post2016-07-19 14:20 +0200
Last post2016-07-19 14:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init() Wei Yongjun <weiyj_lk@163.com> - 2016-07-19 14:20 +0200

#1446376 — [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init()

FromWei Yongjun <weiyj_lk@163.com>
Date2016-07-19 14:20 +0200
Subject[PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init()
Message-ID<rWCad-3Tc-1@gated-at.bofh.it>
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function debugfs_create_file() returns NULL
pointer not ERR_PTR() if debugfs is enabled. The IS_ERR() test
in the return value check should be replaced with NULL test.
(defined(CONFIG_DEBUG_FS) make sure debugfs is enabled)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index b7742e6..8c569ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1345,16 +1345,16 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 
 	ent = debugfs_create_file("amdgpu_vram", S_IFREG | S_IRUGO, root,
 				  adev, &amdgpu_ttm_vram_fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
+	if (!ent)
+		return -ENOMEM;
 	i_size_write(ent->d_inode, adev->mc.mc_vram_size);
 	adev->mman.vram = ent;
 
 #ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
 	ent = debugfs_create_file("amdgpu_gtt", S_IFREG | S_IRUGO, root,
 				  adev, &amdgpu_ttm_gtt_fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
+	if (!ent)
+		return -ENOMEM;
 	i_size_write(ent->d_inode, adev->mc.gtt_size);
 	adev->mman.gtt = ent;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web