linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mm: mmap: Remove unnecessary local variable
@ 2020-12-22 10:32 Adrian Huang
  2020-12-22 15:17 ` Souptick Joarder
  2020-12-29  9:17 ` David Hildenbrand
  0 siblings, 2 replies; 3+ messages in thread
From: Adrian Huang @ 2020-12-22 10:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, Adrian Huang, Adrian Huang

From: Adrian Huang <ahuang12@lenovo.com>

The local variable 'retval' is assigned just for once in __do_sys_brk(),
and the function returns the value of the local variable right after
the assignment. Remove unnecessary assignment and local variable
declaration.

Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
---
 mm/mmap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index dc7206032387..482c0c0bbe06 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -189,7 +189,6 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long
 		struct list_head *uf);
 SYSCALL_DEFINE1(brk, unsigned long, brk)
 {
-	unsigned long retval;
 	unsigned long newbrk, oldbrk, origbrk;
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *next;
@@ -281,9 +280,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
 	return brk;
 
 out:
-	retval = origbrk;
 	mmap_write_unlock(mm);
-	return retval;
+	return origbrk;
 }
 
 static inline unsigned long vma_compute_gap(struct vm_area_struct *vma)
-- 
2.17.1



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

* Re: [PATCH 1/1] mm: mmap: Remove unnecessary local variable
  2020-12-22 10:32 [PATCH 1/1] mm: mmap: Remove unnecessary local variable Adrian Huang
@ 2020-12-22 15:17 ` Souptick Joarder
  2020-12-29  9:17 ` David Hildenbrand
  1 sibling, 0 replies; 3+ messages in thread
From: Souptick Joarder @ 2020-12-22 15:17 UTC (permalink / raw)
  To: Adrian Huang; +Cc: Andrew Morton, Linux-MM, linux-kernel, Adrian Huang

On Tue, Dec 22, 2020 at 4:03 PM Adrian Huang <adrianhuang0701@gmail.com> wrote:
>
> From: Adrian Huang <ahuang12@lenovo.com>
>
> The local variable 'retval' is assigned just for once in __do_sys_brk(),
> and the function returns the value of the local variable right after
> the assignment. Remove unnecessary assignment and local variable
> declaration.
>
> Signed-off-by: Adrian Huang <ahuang12@lenovo.com>

Acked-by: Souptick Joarder <jrdr.linux@gmail.com>

> ---
>  mm/mmap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index dc7206032387..482c0c0bbe06 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -189,7 +189,6 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long
>                 struct list_head *uf);
>  SYSCALL_DEFINE1(brk, unsigned long, brk)
>  {
> -       unsigned long retval;
>         unsigned long newbrk, oldbrk, origbrk;
>         struct mm_struct *mm = current->mm;
>         struct vm_area_struct *next;
> @@ -281,9 +280,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
>         return brk;
>
>  out:
> -       retval = origbrk;
>         mmap_write_unlock(mm);
> -       return retval;
> +       return origbrk;
>  }
>
>  static inline unsigned long vma_compute_gap(struct vm_area_struct *vma)
> --
> 2.17.1
>
>


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

* Re: [PATCH 1/1] mm: mmap: Remove unnecessary local variable
  2020-12-22 10:32 [PATCH 1/1] mm: mmap: Remove unnecessary local variable Adrian Huang
  2020-12-22 15:17 ` Souptick Joarder
@ 2020-12-29  9:17 ` David Hildenbrand
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2020-12-29  9:17 UTC (permalink / raw)
  To: Adrian Huang, Andrew Morton; +Cc: linux-mm, linux-kernel, Adrian Huang

On 22.12.20 11:32, Adrian Huang wrote:
> From: Adrian Huang <ahuang12@lenovo.com>
> 
> The local variable 'retval' is assigned just for once in __do_sys_brk(),
> and the function returns the value of the local variable right after
> the assignment. Remove unnecessary assignment and local variable
> declaration.
> 
> Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
> ---
>  mm/mmap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index dc7206032387..482c0c0bbe06 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -189,7 +189,6 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long
>  		struct list_head *uf);
>  SYSCALL_DEFINE1(brk, unsigned long, brk)
>  {
> -	unsigned long retval;
>  	unsigned long newbrk, oldbrk, origbrk;
>  	struct mm_struct *mm = current->mm;
>  	struct vm_area_struct *next;
> @@ -281,9 +280,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
>  	return brk;
>  
>  out:
> -	retval = origbrk;
>  	mmap_write_unlock(mm);
> -	return retval;
> +	return origbrk;
>  }

Reviewed-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb



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

end of thread, other threads:[~2020-12-29  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 10:32 [PATCH 1/1] mm: mmap: Remove unnecessary local variable Adrian Huang
2020-12-22 15:17 ` Souptick Joarder
2020-12-29  9:17 ` David Hildenbrand

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