Skip to contentSkip to conversation

futex: Remove unneeded gotos

PATCH Applied [email protected] 2 participants 3 messages Dec 30, 2020 – Jan 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 futex: Remove unneeded gotos

From: Jangwoong Kim <[email protected]>

Get rid of gotos that do not contain any cleanup.

According to coding style documentation: "If there is no cleanup needed then just return directly"

---
 kernel/futex.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/futex.c +3 -4
index c47d1015d759..0490d7e7fe7f 100644
@@ -3024,7 +3024,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
 		 * Success, we're done! No tricky corner cases.
 		 */
 		if (!ret)
-			goto out_putkey;
+			return ret;
 		/*
 		 * The atomic access to the futex value generated a
 		 * pagefault, so retry the user-access and the wakeup:
@@ -3041,7 +3041,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
 		 * wake_futex_pi has detected invalid state. Tell user
 		 * space.
 		 */
-		goto out_putkey;
+		return ret;
 	}
 
 	/*
@@ -3062,7 +3062,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
 
 		default:
 			WARN_ON_ONCE(1);
-			goto out_putkey;
+			return ret;
 		}
 	}
 
@@ -3073,7 +3073,6 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
 
 out_unlock:
 	spin_unlock(&hb->lock);
-out_putkey:
 	return ret;
 
 pi_retry:
Signature · 1 line
2.17.1
merge bot Applied
#1 lore raw
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     cfb8364aec4317f8e0695e4c9779b3413ce36ef4
Gitweb:        https://git.kernel.org/tip/cfb8364aec4317f8e0695e4c9779b3413ce36ef4
Author:        Jangwoong Kim <[email protected]>
AuthorDate:    Wed, 30 Dec 2020 21:29:53 +09:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Wed, 27 Jan 2021 12:37:27 +01:00

futex: Remove unneeded gotos

Get rid of gotos that do not contain any cleanup. These were not removed in commit 9180bd467f9a ("futex: Remove put_futex_key()").

---
 kernel/futex.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/futex.c +3 -4
index d0775aa..f3570a2 100644
@@ -3024,7 +3024,7 @@ retry:
 		 * Success, we're done! No tricky corner cases.
 		 */
 		if (!ret)
-			goto out_putkey;
+			return ret;
 		/*
 		 * The atomic access to the futex value generated a
 		 * pagefault, so retry the user-access and the wakeup:
@@ -3041,7 +3041,7 @@ retry:
 		 * wake_futex_pi has detected invalid state. Tell user
 		 * space.
 		 */
-		goto out_putkey;
+		return ret;
 	}
 
 	/*
@@ -3062,7 +3062,7 @@ retry:
 
 		default:
 			WARN_ON_ONCE(1);
-			goto out_putkey;
+			return ret;
 		}
 	}
 
@@ -3073,7 +3073,6 @@ retry:
 
 out_unlock:
 	spin_unlock(&hb->lock);
-out_putkey:
 	return ret;
 
 pi_retry:
merge bot Applied
#2 lore raw
In reply to [email protected]
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     0f9438503ea1312ef49be4d9762e0f0006546364
Gitweb:        https://git.kernel.org/tip/0f9438503ea1312ef49be4d9762e0f0006546364
Author:        Jangwoong Kim <[email protected]>
AuthorDate:    Wed, 30 Dec 2020 21:29:53 +09:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 28 Jan 2021 13:20:18 +01:00

futex: Remove unneeded gotos

Get rid of gotos that do not contain any cleanup. These were not removed in commit 9180bd467f9a ("futex: Remove put_futex_key()").

---
 kernel/futex.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/futex.c +3 -4
index d0775aa..f3570a2 100644
@@ -3024,7 +3024,7 @@ retry:
 		 * Success, we're done! No tricky corner cases.
 		 */
 		if (!ret)
-			goto out_putkey;
+			return ret;
 		/*
 		 * The atomic access to the futex value generated a
 		 * pagefault, so retry the user-access and the wakeup:
@@ -3041,7 +3041,7 @@ retry:
 		 * wake_futex_pi has detected invalid state. Tell user
 		 * space.
 		 */
-		goto out_putkey;
+		return ret;
 	}
 
 	/*
@@ -3062,7 +3062,7 @@ retry:
 
 		default:
 			WARN_ON_ONCE(1);
-			goto out_putkey;
+			return ret;
 		}
 	}
 
@@ -3073,7 +3073,6 @@ retry:
 
 out_unlock:
 	spin_unlock(&hb->lock);
-out_putkey:
 	return ret;
 
 pi_retry: