linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_owner: Use PTR_ERR_OR_ZERO()
@ 2017-11-27 23:08 Vasyl Gomonovych
  2017-11-28  8:14 ` Michal Hocko
  2017-11-28  8:22 ` Vlastimil Babka
  0 siblings, 2 replies; 3+ messages in thread
From: Vasyl Gomonovych @ 2017-11-27 23:08 UTC (permalink / raw)
  To: vbabka, akpm, mhocko, gregkh, tglx, vinmenon, guptap, linux-mm
  Cc: gomonovych, linux-kernel

Fix ptr_ret.cocci warnings:
mm/page_owner.c:639:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
---
 mm/page_owner.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 4f44b95b9d1e..79ae586d1bce 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -636,9 +636,7 @@ static int __init pageowner_init(void)
 
 	dentry = debugfs_create_file("page_owner", S_IRUSR, NULL,
 			NULL, &proc_page_owner_operations);
-	if (IS_ERR(dentry))
-		return PTR_ERR(dentry);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(dentry);
 }
 late_initcall(pageowner_init)
-- 
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/page_owner: Use PTR_ERR_OR_ZERO()
  2017-11-27 23:08 [PATCH] mm/page_owner: Use PTR_ERR_OR_ZERO() Vasyl Gomonovych
@ 2017-11-28  8:14 ` Michal Hocko
  2017-11-28  8:22 ` Vlastimil Babka
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2017-11-28  8:14 UTC (permalink / raw)
  To: Vasyl Gomonovych
  Cc: vbabka, akpm, gregkh, tglx, vinmenon, guptap, linux-mm, linux-kernel

On Tue 28-11-17 00:08:21, Vasyl Gomonovych wrote:
> Fix ptr_ret.cocci warnings:
> mm/page_owner.c:639:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci

OK, this is easier to read. Is this the only place that we have in the
mm tree? I do not see more patches on linux-mm mailing list.

> Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/page_owner.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 4f44b95b9d1e..79ae586d1bce 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -636,9 +636,7 @@ static int __init pageowner_init(void)
>  
>  	dentry = debugfs_create_file("page_owner", S_IRUSR, NULL,
>  			NULL, &proc_page_owner_operations);
> -	if (IS_ERR(dentry))
> -		return PTR_ERR(dentry);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(dentry);
>  }
>  late_initcall(pageowner_init)
> -- 
> 1.9.1
> 

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/page_owner: Use PTR_ERR_OR_ZERO()
  2017-11-27 23:08 [PATCH] mm/page_owner: Use PTR_ERR_OR_ZERO() Vasyl Gomonovych
  2017-11-28  8:14 ` Michal Hocko
@ 2017-11-28  8:22 ` Vlastimil Babka
  1 sibling, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2017-11-28  8:22 UTC (permalink / raw)
  To: Vasyl Gomonovych, akpm, mhocko, gregkh, tglx, vinmenon, guptap, linux-mm
  Cc: linux-kernel

On 11/28/2017 12:08 AM, Vasyl Gomonovych wrote:
> Fix ptr_ret.cocci warnings:
> mm/page_owner.c:639:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/page_owner.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 4f44b95b9d1e..79ae586d1bce 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -636,9 +636,7 @@ static int __init pageowner_init(void)
>  
>  	dentry = debugfs_create_file("page_owner", S_IRUSR, NULL,
>  			NULL, &proc_page_owner_operations);
> -	if (IS_ERR(dentry))
> -		return PTR_ERR(dentry);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(dentry);
>  }
>  late_initcall(pageowner_init)
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2017-11-28  8:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 23:08 [PATCH] mm/page_owner: Use PTR_ERR_OR_ZERO() Vasyl Gomonovych
2017-11-28  8:14 ` Michal Hocko
2017-11-28  8:22 ` Vlastimil Babka

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