All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] drm/i915: fix return value check of debugfs_create_file()
@ 2013-12-16  6:13 Wei Yongjun
  2013-12-16 10:05   ` Daniel Vetter
  2013-12-16 11:06   ` Damien Lespiau
  0 siblings, 2 replies; 5+ messages in thread
From: Wei Yongjun @ 2013-12-16  6:13 UTC (permalink / raw)
  To: daniel.vetter, airlied; +Cc: yongjun_wei, intel-gfx, 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.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 7008aac..856e18b 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1920,8 +1920,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
 	info->dev = dev;
 	ent = debugfs_create_file(info->name, S_IRUGO, root, info,
 				  &i915_pipe_crc_fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
+	if (!ent)
+		return -ENOMEM;
 
 	return drm_add_fake_info_node(minor, ent, info);
 }
@@ -2931,8 +2931,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
 				  S_IRUSR,
 				  root, dev,
 				  &i915_forcewake_fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
+	if (!ent)
+		return -ENOMEM;
 
 	return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
 }
@@ -2949,8 +2949,8 @@ static int i915_debugfs_create(struct dentry *root,
 				  S_IRUGO | S_IWUSR,
 				  root, dev,
 				  fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
+	if (!ent)
+		return -ENOMEM;
 
 	return drm_add_fake_info_node(minor, ent, fops);
 }


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

* Re: [PATCH -next] drm/i915: fix return value check of debugfs_create_file()
  2013-12-16  6:13 [PATCH -next] drm/i915: fix return value check of debugfs_create_file() Wei Yongjun
@ 2013-12-16 10:05   ` Daniel Vetter
  2013-12-16 11:06   ` Damien Lespiau
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2013-12-16 10:05 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: daniel.vetter, airlied, yongjun_wei, intel-gfx, dri-devel, linux-kernel

On Mon, Dec 16, 2013 at 02:13:25PM +0800, Wei Yongjun wrote:
> 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.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Nice catch! Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7008aac..856e18b 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1920,8 +1920,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
>  	info->dev = dev;
>  	ent = debugfs_create_file(info->name, S_IRUGO, root, info,
>  				  &i915_pipe_crc_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, info);
>  }
> @@ -2931,8 +2931,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
>  				  S_IRUSR,
>  				  root, dev,
>  				  &i915_forcewake_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
>  }
> @@ -2949,8 +2949,8 @@ static int i915_debugfs_create(struct dentry *root,
>  				  S_IRUGO | S_IWUSR,
>  				  root, dev,
>  				  fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, fops);
>  }
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: [PATCH -next] drm/i915: fix return value check of debugfs_create_file()
@ 2013-12-16 10:05   ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2013-12-16 10:05 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: airlied, daniel.vetter, intel-gfx, linux-kernel, dri-devel, yongjun_wei

On Mon, Dec 16, 2013 at 02:13:25PM +0800, Wei Yongjun wrote:
> 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.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Nice catch! Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7008aac..856e18b 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1920,8 +1920,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
>  	info->dev = dev;
>  	ent = debugfs_create_file(info->name, S_IRUGO, root, info,
>  				  &i915_pipe_crc_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, info);
>  }
> @@ -2931,8 +2931,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
>  				  S_IRUSR,
>  				  root, dev,
>  				  &i915_forcewake_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
>  }
> @@ -2949,8 +2949,8 @@ static int i915_debugfs_create(struct dentry *root,
>  				  S_IRUGO | S_IWUSR,
>  				  root, dev,
>  				  fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, fops);
>  }
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: [Intel-gfx] [PATCH -next] drm/i915: fix return value check of debugfs_create_file()
  2013-12-16  6:13 [PATCH -next] drm/i915: fix return value check of debugfs_create_file() Wei Yongjun
@ 2013-12-16 11:06   ` Damien Lespiau
  2013-12-16 11:06   ` Damien Lespiau
  1 sibling, 0 replies; 5+ messages in thread
From: Damien Lespiau @ 2013-12-16 11:06 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: daniel.vetter, airlied, yongjun_wei, intel-gfx, dri-devel, linux-kernel

On Mon, Dec 16, 2013 at 02:13:25PM +0800, Wei Yongjun wrote:
> 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.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

-- 
Damien

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7008aac..856e18b 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1920,8 +1920,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
>  	info->dev = dev;
>  	ent = debugfs_create_file(info->name, S_IRUGO, root, info,
>  				  &i915_pipe_crc_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, info);
>  }
> @@ -2931,8 +2931,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
>  				  S_IRUSR,
>  				  root, dev,
>  				  &i915_forcewake_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
>  }
> @@ -2949,8 +2949,8 @@ static int i915_debugfs_create(struct dentry *root,
>  				  S_IRUGO | S_IWUSR,
>  				  root, dev,
>  				  fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, fops);
>  }
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH -next] drm/i915: fix return value check of debugfs_create_file()
@ 2013-12-16 11:06   ` Damien Lespiau
  0 siblings, 0 replies; 5+ messages in thread
From: Damien Lespiau @ 2013-12-16 11:06 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: daniel.vetter, intel-gfx, linux-kernel, dri-devel, yongjun_wei

On Mon, Dec 16, 2013 at 02:13:25PM +0800, Wei Yongjun wrote:
> 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.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

-- 
Damien

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7008aac..856e18b 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1920,8 +1920,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
>  	info->dev = dev;
>  	ent = debugfs_create_file(info->name, S_IRUGO, root, info,
>  				  &i915_pipe_crc_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, info);
>  }
> @@ -2931,8 +2931,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
>  				  S_IRUSR,
>  				  root, dev,
>  				  &i915_forcewake_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
>  }
> @@ -2949,8 +2949,8 @@ static int i915_debugfs_create(struct dentry *root,
>  				  S_IRUGO | S_IWUSR,
>  				  root, dev,
>  				  fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> +	if (!ent)
> +		return -ENOMEM;
>  
>  	return drm_add_fake_info_node(minor, ent, fops);
>  }
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2013-12-16 11:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16  6:13 [PATCH -next] drm/i915: fix return value check of debugfs_create_file() Wei Yongjun
2013-12-16 10:05 ` Daniel Vetter
2013-12-16 10:05   ` Daniel Vetter
2013-12-16 11:06 ` [Intel-gfx] " Damien Lespiau
2013-12-16 11:06   ` Damien Lespiau

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.