linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/amdgpu: fix return value check in amdgpu_debugfs_regs_init()
@ 2016-07-19 12:14 Wei Yongjun
  2016-07-19 12:25 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-07-19 12:14 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, Flora.Cui,
	David1.Zhou, tom.stdenis, 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_*() 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_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 614fb02..0c992d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2530,12 +2530,12 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
 		ent = debugfs_create_file(debugfs_regs_names[i],
 					  S_IFREG | S_IRUGO, root,
 					  adev, debugfs_regs[i]);
-		if (IS_ERR(ent)) {
+		if (!ent) {
 			for (j = 0; j < i; j++) {
 				debugfs_remove(adev->debugfs_regs[i]);
 				adev->debugfs_regs[i] = NULL;
 			}
-			return PTR_ERR(ent);
+			return -ENOMEM;
 		}
 
 		if (!i)

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

* Re: [PATCH -next] drm/amdgpu: fix return value check in amdgpu_debugfs_regs_init()
  2016-07-19 12:14 [PATCH -next] drm/amdgpu: fix return value check in amdgpu_debugfs_regs_init() Wei Yongjun
@ 2016-07-19 12:25 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2016-07-19 12:25 UTC (permalink / raw)
  To: Wei Yongjun, alexander.deucher, airlied, Flora.Cui, David1.Zhou,
	tom.stdenis, Jammy.Zhou
  Cc: Wei Yongjun, dri-devel, linux-kernel

Am 19.07.2016 um 14:14 schrieb Wei Yongjun:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function debugfs_create_*() 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_device.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 614fb02..0c992d3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2530,12 +2530,12 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
>   		ent = debugfs_create_file(debugfs_regs_names[i],
>   					  S_IFREG | S_IRUGO, root,
>   					  adev, debugfs_regs[i]);
> -		if (IS_ERR(ent)) {
> +		if (!ent) {
>   			for (j = 0; j < i; j++) {
>   				debugfs_remove(adev->debugfs_regs[i]);
>   				adev->debugfs_regs[i] = NULL;
>   			}
> -			return PTR_ERR(ent);
> +			return -ENOMEM;
>   		}
>   
>   		if (!i)
>
>

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

end of thread, other threads:[~2016-07-19 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 12:14 [PATCH -next] drm/amdgpu: fix return value check in amdgpu_debugfs_regs_init() Wei Yongjun
2016-07-19 12:25 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).