linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Adrian Huang <adrianhuang0701@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Adrian Huang <ahuang12@lenovo.com>
Subject: Re: [PATCH 1/1] mm: mmap: Remove unnecessary local variable
Date: Tue, 29 Dec 2020 10:17:46 +0100	[thread overview]
Message-ID: <da7962ac-e5dc-9113-6444-c03e7850f83b@redhat.com> (raw)
In-Reply-To: <20201222103249.30683-1-adrianhuang0701@gmail.com>

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


      parent reply	other threads:[~2020-12-29  9:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da7962ac-e5dc-9113-6444-c03e7850f83b@redhat.com \
    --to=david@redhat.com \
    --cc=adrianhuang0701@gmail.com \
    --cc=ahuang12@lenovo.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).