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


Groups > linux.kernel > #1290587

[PATCH] include/asm-generic/pgtable.h: Remove redundant variable r

From Chen Gang <chengang@emindsoft.com.cn>
Newsgroups linux.kernel
Subject [PATCH] include/asm-generic/pgtable.h: Remove redundant variable r
Date 2015-12-13 10:20 +0100
Message-ID <qFaYV-6rZ-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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
--
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/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] include/asm-generic/pgtable.h: Remove redundant variable  r Chen Gang <chengang@emindsoft.com.cn> - 2015-12-13 10:20 +0100

csiph-web