Skip to content

Commit 9180bd4

Browse files
andrealmeidKAGA-KOKO
authored andcommitted
futex: Remove put_futex_key()
Since 4b39f99 ("futex: Remove {get,drop}_futex_key_refs()"), put_futex_key() is empty. Remove all references for this function and the then redundant labels. Signed-off-by: André Almeida <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a9232dc commit 9180bd4

File tree

1 file changed

+12
-49
lines changed

1 file changed

+12
-49
lines changed

kernel/futex.c

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,6 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a
677677
return err;
678678
}
679679

680-
static inline void put_futex_key(union futex_key *key)
681-
{
682-
}
683-
684680
/**
685681
* fault_in_user_writeable() - Fault in user address and verify RW access
686682
* @uaddr: pointer to faulting user space address
@@ -1617,7 +1613,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset)
16171613

16181614
/* Make sure we really have tasks to wakeup */
16191615
if (!hb_waiters_pending(hb))
1620-
goto out_put_key;
1616+
goto out;
16211617

16221618
spin_lock(&hb->lock);
16231619

@@ -1640,8 +1636,6 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset)
16401636

16411637
spin_unlock(&hb->lock);
16421638
wake_up_q(&wake_q);
1643-
out_put_key:
1644-
put_futex_key(&key);
16451639
out:
16461640
return ret;
16471641
}
@@ -1712,7 +1706,7 @@ futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
17121706
goto out;
17131707
ret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2, FUTEX_WRITE);
17141708
if (unlikely(ret != 0))
1715-
goto out_put_key1;
1709+
goto out;
17161710

17171711
hb1 = hash_futex(&key1);
17181712
hb2 = hash_futex(&key2);
@@ -1730,22 +1724,20 @@ futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
17301724
* an MMU, but we might get them from range checking
17311725
*/
17321726
ret = op_ret;
1733-
goto out_put_keys;
1727+
goto out;
17341728
}
17351729

17361730
if (op_ret == -EFAULT) {
17371731
ret = fault_in_user_writeable(uaddr2);
17381732
if (ret)
1739-
goto out_put_keys;
1733+
goto out;
17401734
}
17411735

17421736
if (!(flags & FLAGS_SHARED)) {
17431737
cond_resched();
17441738
goto retry_private;
17451739
}
17461740

1747-
put_futex_key(&key2);
1748-
put_futex_key(&key1);
17491741
cond_resched();
17501742
goto retry;
17511743
}
@@ -1781,10 +1773,6 @@ futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
17811773
out_unlock:
17821774
double_unlock_hb(hb1, hb2);
17831775
wake_up_q(&wake_q);
1784-
out_put_keys:
1785-
put_futex_key(&key2);
1786-
out_put_key1:
1787-
put_futex_key(&key1);
17881776
out:
17891777
return ret;
17901778
}
@@ -1996,15 +1984,15 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
19961984
ret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2,
19971985
requeue_pi ? FUTEX_WRITE : FUTEX_READ);
19981986
if (unlikely(ret != 0))
1999-
goto out_put_key1;
1987+
goto out;
20001988

20011989
/*
20021990
* The check above which compares uaddrs is not sufficient for
20031991
* shared futexes. We need to compare the keys:
20041992
*/
20051993
if (requeue_pi && match_futex(&key1, &key2)) {
20061994
ret = -EINVAL;
2007-
goto out_put_keys;
1995+
goto out;
20081996
}
20091997

20101998
hb1 = hash_futex(&key1);
@@ -2025,13 +2013,11 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
20252013

20262014
ret = get_user(curval, uaddr1);
20272015
if (ret)
2028-
goto out_put_keys;
2016+
goto out;
20292017

20302018
if (!(flags & FLAGS_SHARED))
20312019
goto retry_private;
20322020

2033-
put_futex_key(&key2);
2034-
put_futex_key(&key1);
20352021
goto retry;
20362022
}
20372023
if (curval != *cmpval) {
@@ -2090,8 +2076,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
20902076
case -EFAULT:
20912077
double_unlock_hb(hb1, hb2);
20922078
hb_waiters_dec(hb2);
2093-
put_futex_key(&key2);
2094-
put_futex_key(&key1);
20952079
ret = fault_in_user_writeable(uaddr2);
20962080
if (!ret)
20972081
goto retry;
@@ -2106,8 +2090,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
21062090
*/
21072091
double_unlock_hb(hb1, hb2);
21082092
hb_waiters_dec(hb2);
2109-
put_futex_key(&key2);
2110-
put_futex_key(&key1);
21112093
/*
21122094
* Handle the case where the owner is in the middle of
21132095
* exiting. Wait for the exit to complete otherwise
@@ -2217,10 +2199,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
22172199
wake_up_q(&wake_q);
22182200
hb_waiters_dec(hb2);
22192201

2220-
out_put_keys:
2221-
put_futex_key(&key2);
2222-
out_put_key1:
2223-
put_futex_key(&key1);
22242202
out:
22252203
return ret ? ret : task_count;
22262204
}
@@ -2697,7 +2675,6 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags,
26972675
if (!(flags & FLAGS_SHARED))
26982676
goto retry_private;
26992677

2700-
put_futex_key(&q->key);
27012678
goto retry;
27022679
}
27032680

@@ -2707,8 +2684,6 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags,
27072684
}
27082685

27092686
out:
2710-
if (ret)
2711-
put_futex_key(&q->key);
27122687
return ret;
27132688
}
27142689

@@ -2853,7 +2828,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags,
28532828
* - EAGAIN: The user space value changed.
28542829
*/
28552830
queue_unlock(hb);
2856-
put_futex_key(&q.key);
28572831
/*
28582832
* Handle the case where the owner is in the middle of
28592833
* exiting. Wait for the exit to complete otherwise
@@ -2961,13 +2935,11 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags,
29612935
put_pi_state(pi_state);
29622936
}
29632937

2964-
goto out_put_key;
2938+
goto out;
29652939

29662940
out_unlock_put_key:
29672941
queue_unlock(hb);
29682942

2969-
out_put_key:
2970-
put_futex_key(&q.key);
29712943
out:
29722944
if (to) {
29732945
hrtimer_cancel(&to->timer);
@@ -2980,12 +2952,11 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags,
29802952

29812953
ret = fault_in_user_writeable(uaddr);
29822954
if (ret)
2983-
goto out_put_key;
2955+
goto out;
29842956

29852957
if (!(flags & FLAGS_SHARED))
29862958
goto retry_private;
29872959

2988-
put_futex_key(&q.key);
29892960
goto retry;
29902961
}
29912962

@@ -3114,16 +3085,13 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
31143085
out_unlock:
31153086
spin_unlock(&hb->lock);
31163087
out_putkey:
3117-
put_futex_key(&key);
31183088
return ret;
31193089

31203090
pi_retry:
3121-
put_futex_key(&key);
31223091
cond_resched();
31233092
goto retry;
31243093

31253094
pi_faulted:
3126-
put_futex_key(&key);
31273095

31283096
ret = fault_in_user_writeable(uaddr);
31293097
if (!ret)
@@ -3265,7 +3233,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
32653233
*/
32663234
ret = futex_wait_setup(uaddr, val, flags, &q, &hb);
32673235
if (ret)
3268-
goto out_key2;
3236+
goto out;
32693237

32703238
/*
32713239
* The check above which compares uaddrs is not sufficient for
@@ -3274,7 +3242,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
32743242
if (match_futex(&q.key, &key2)) {
32753243
queue_unlock(hb);
32763244
ret = -EINVAL;
3277-
goto out_put_keys;
3245+
goto out;
32783246
}
32793247

32803248
/* Queue the futex_q, drop the hb lock, wait for wakeup. */
@@ -3284,7 +3252,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
32843252
ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to);
32853253
spin_unlock(&hb->lock);
32863254
if (ret)
3287-
goto out_put_keys;
3255+
goto out;
32883256

32893257
/*
32903258
* In order for us to be here, we know our q.key == key2, and since
@@ -3374,11 +3342,6 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
33743342
ret = -EWOULDBLOCK;
33753343
}
33763344

3377-
out_put_keys:
3378-
put_futex_key(&q.key);
3379-
out_key2:
3380-
put_futex_key(&key2);
3381-
33823345
out:
33833346
if (to) {
33843347
hrtimer_cancel(&to->timer);

0 commit comments

Comments
 (0)