* [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init()
@ 2016-07-19 12:15 Wei Yongjun
2016-07-19 12:26 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2016-07-19 12:15 UTC (permalink / raw)
To: alexander.deucher, christian.koenig, airlied, David1.Zhou,
Felix.Kuehling, Jammy.Zhou
Cc: Wei Yongjun, dri-devel, linux-kernel
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init()
2016-07-19 12:15 [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init() Wei Yongjun
@ 2016-07-19 12:26 ` Christian König
0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2016-07-19 12:26 UTC (permalink / raw)
To: Wei Yongjun, alexander.deucher, airlied, David1.Zhou,
Felix.Kuehling, Jammy.Zhou
Cc: Wei Yongjun, linux-kernel, dri-devel
Am 19.07.2016 um 14:15 schrieb Wei Yongjun:
> 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>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> 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;
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init()
@ 2016-07-19 12:26 ` Christian König
0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2016-07-19 12:26 UTC (permalink / raw)
To: Wei Yongjun, alexander.deucher, airlied, David1.Zhou,
Felix.Kuehling, Jammy.Zhou
Cc: Wei Yongjun, dri-devel, linux-kernel
Am 19.07.2016 um 14:15 schrieb Wei Yongjun:
> 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>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> 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;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-19 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 12:15 [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init() Wei Yongjun
2016-07-19 12:26 ` Christian König
2016-07-19 12:26 ` Christian König
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.