Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1239699 > unrolled thread

[PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"

Started byChen Gang <xili_gchen_5257@hotmail.com>
First post2015-10-05 18:00 +0200
Last post2015-10-05 18:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM" Chen Gang <xili_gchen_5257@hotmail.com> - 2015-10-05 18:00 +0200
    Re: [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM" Oleg Nesterov <oleg@redhat.com> - 2015-10-05 18:30 +0200

#1239699 — [PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"

FromChen Gang <xili_gchen_5257@hotmail.com>
Date2015-10-05 18:00 +0200
Subject[PATCH] mm/mmap.c: Remove redundant statement "error = -ENOMEM"
Message-ID<qggld-3nE-29@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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

 		 	   		  

[toc] | [next] | [standalone]


#1239726

FromOleg Nesterov <oleg@redhat.com>
Date2015-10-05 18:30 +0200
Message-ID<qggOe-4bm-21@gated-at.bofh.it>
In reply to#1239699
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
> 
>  		 	   		  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web