Skip to contentSkip to conversation

arch/x86/mm/mpx.c: Clean up code by removing unnecessary assignment

PATCH In review [email protected] 2 participants 2 messages Jan 19, 2020 – Jan 22, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/x86/mm/mpx.c: Clean up code by removing unnecessary assignment

From: Mateusz Nosek <[email protected]>

Previously variable 'ret' is assigned just before return instruction. The variable is local so this assignment is useless
and therefore can be removed.

---
 arch/x86/mm/mpx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/mm/mpx.c +1 -3
index 895fb7a9294d..30ab444301f5 100644
@@ -827,10 +827,8 @@ static int try_unmap_single_bt(struct mm_struct *mm,
 	/*
 	 * No bounds table there, so nothing to unmap.
 	 */
-	if (ret == -ENOENT) {
-		ret = 0;
+	if (ret == -ENOENT)
 		return 0;
-	}
 	if (ret)
 		return ret;
 	/*
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 18 lines · On Sun, Jan 19, 2020 at 02:09:33PM +0100, [email protected] wrote:

From: Mateusz Nosek <[email protected]>

Previously variable 'ret' is assigned just before return instruction. The variable is local so this assignment is useless
and therefore can be removed.

---
 arch/x86/mm/mpx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/mm/mpx.c +0 -0
index 895fb7a9294d..30ab444301f5 100644
@@ -827,10 +827,8 @@ static int try_unmap_single_bt(struct mm_struct *mm,
 	/*

arch/x86/mm/mpx.c static int try_unmap_single_bt(struct mm_struct *mm, · line 834

Quoted 10 lines
arch/x86/mm/mpx.c +1 -3
 	 * No bounds table there, so nothing to unmap.
 	 */
-	if (ret == -ENOENT) {
-		ret = 0;
+	if (ret == -ENOENT)
 		return 0;
-	}
 	if (ret)
 		return ret;
 	/*

That code is going away so you can ignore it completely.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette