linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"
@ 2015-10-05 15:55 Chen Gang
  2015-10-05 16:24 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2015-10-05 15:55 UTC (permalink / raw)
  To: Andrew Morton, kirill.shutemov, riel, Michal Hocko, oleg,
	emunson, sasha.levin, pfeiner, aarcange, vishnu.ps
  Cc: Linux Memory, kernel mailing list

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

>From 4150fd59c4aa35d36e81920ecb2a522c8c7b68b9 Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5i5j@gmail.com>
Date: Mon, 5 Oct 2015 23:43:30 +0800
Subject: [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"

It is still a little better to remove it, although it should be skipped
by "-O2".

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 mm/mmap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 8393580..1da4600 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1562,7 +1562,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
 	}
 
 	/* Clear old maps */
-	error = -ENOMEM;
 	while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
 			      &rb_parent)) {
 		if (do_munmap(mm, addr, len))
-- 
1.9.3

 		 	   		  

[-- Attachment #2: 0001-mm-mmap.c-Remove-redundant-statement-error-ENOMEM.patch --]
[-- Type: application/octet-stream, Size: 777 bytes --]

From 4150fd59c4aa35d36e81920ecb2a522c8c7b68b9 Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5i5j@gmail.com>
Date: Mon, 5 Oct 2015 23:43:30 +0800
Subject: [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"

It is still a little better to remove it, although it should be skipped
by "-O2".

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 mm/mmap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 8393580..1da4600 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1562,7 +1562,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
 	}
 
 	/* Clear old maps */
-	error = -ENOMEM;
 	while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
 			      &rb_parent)) {
 		if (do_munmap(mm, addr, len))
-- 
1.9.3


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

* Re: [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"
  2015-10-05 15:55 [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM" Chen Gang
@ 2015-10-05 16:24 ` Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2015-10-05 16:24 UTC (permalink / raw)
  To: Chen Gang
  Cc: Andrew Morton, kirill.shutemov, riel, Michal Hocko, emunson,
	sasha.levin, pfeiner, aarcange, vishnu.ps, Linux Memory,
	kernel mailing list

On 10/05, Chen Gang wrote:
>
> It is still a little better to remove it, although it should be skipped
> by "-O2".

Agreed, it can confuse the reader.

> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>

Acked-by: Oleg Nesterov <oleg@redhat.com>

> ---
>  mm/mmap.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 8393580..1da4600 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1562,7 +1562,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
>  	}
>  
>  	/* Clear old maps */
> -	error = -ENOMEM;
>  	while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
>  			      &rb_parent)) {
>  		if (do_munmap(mm, addr, len))
> -- 
> 1.9.3
> 
>  		 	   		  



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

end of thread, other threads:[~2015-10-05 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 15:55 [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM" Chen Gang
2015-10-05 16:24 ` Oleg Nesterov

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).