Skip to content

Commit 9871b5a

Browse files
author
Uzair Nawaz
committed
used function line info when return instruction has no line numbers attached
fix new checklock errors revert pass on prev and new checklocks versions remove whitespace
1 parent 17e4b24 commit 9871b5a

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

pkg/tcpip/transport/tcp/endpoint.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ func (e *Endpoint) LockUser() {
688688
// Finally just give up and wait for the Lock.
689689
e.mu.Lock()
690690
e.ownedByUser.Store(1)
691+
return // +checklocksforce: this locks e.snd.ep.mu
691692
}
692693

693694
// UnlockUser will check if there are any segments already queued for processing
@@ -753,6 +754,7 @@ func (e *Endpoint) AssertLockHeld(locked *Endpoint) {
753754
if e != locked {
754755
panic("AssertLockHeld failed: locked endpoint != asserting endpoint")
755756
}
757+
return // +checklocksforce
756758
}
757759

758760
// TryLock is a helper that calls TryLock on the endpoint's mutex and

tools/checklocks/test/branches.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func testInconsistentReturn(tc *oneGuardStruct) { // +checklocksfail
2222
if x := rand.Intn(10); x%2 == 1 {
2323
tc.mu.Lock()
2424
}
25+
return
2526
}
2627

2728
func testConsistentBranching(tc *oneGuardStruct) {
@@ -53,6 +54,7 @@ func testInconsistentBranching(tc *oneGuardStruct) { // +checklocksfail:2
5354
if x%2 == 1 {
5455
tc.mu.Unlock() // +checklocksforce
5556
}
57+
return
5658
}
5759

5860
func testUnboundedLocks(tc []*oneGuardStruct) {

tools/checklocks/test/methods.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func standaloneFunctionWithGuard(a *testMethodsWithParameters) {
9696
a.guardedField = 1
9797
a.mu.Unlock()
9898
a.guardedField = 1 // +checklocksfail
99+
return // +checklocksfail
99100
}
100101

101102
type testMethodsWithEmbedded struct {

0 commit comments

Comments
 (0)