linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Gang <chengang@emindsoft.com.cn>
To: arnd@arndb.de, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arch@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Chen Gang <gang.chen.5i5j@gmail.com>,
	chenwei@emindsoft.com.cn
Subject: [PATCH] include/asm-generic/pgtable.h: Remove redundant variable r
Date: Sun, 13 Dec 2015 17:09:48 +0800	[thread overview]
Message-ID: <566D35DC.6090801@emindsoft.com.cn> (raw)


Return the immediate number directly.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 include/asm-generic/pgtable.h | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index aecf0141..069536a 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -51,12 +51,11 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
 					    pte_t *ptep)
 {
 	pte_t pte = *ptep;
-	int r = 1;
+
 	if (!pte_young(pte))
-		r = 0;
-	else
-		set_pte_at(vma->vm_mm, address, ptep, pte_mkold(pte));
-	return r;
+		return 0;
+	set_pte_at(vma->vm_mm, address, ptep, pte_mkold(pte));
+	return 1;
 }
 #endif
 
@@ -67,12 +66,11 @@ static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    pmd_t *pmdp)
 {
 	pmd_t pmd = *pmdp;
-	int r = 1;
+
 	if (!pmd_young(pmd))
-		r = 0;
-	else
-		set_pmd_at(vma->vm_mm, address, pmdp, pmd_mkold(pmd));
-	return r;
+		return 0;
+	set_pmd_at(vma->vm_mm, address, pmdp, pmd_mkold(pmd));
+	return 1;
 }
 #else
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
-- 
1.9.3

                 reply	other threads:[~2015-12-13  9:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=566D35DC.6090801@emindsoft.com.cn \
    --to=chengang@emindsoft.com.cn \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=chenwei@emindsoft.com.cn \
    --cc=gang.chen.5i5j@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).