Remove some false positives and enable the check.
[smatch.git] / validation / sm_locking3.c
blobc5603ad0fbbc144e0ffd39316ae7866a0b93ee84
1 _spin_trylock(int name);
2 _spin_lock(int name);
3 _spin_unlock(int name);
5 int func (void)
7 int mylock = 1;
9 if (!({frob(); frob(); _spin_trylock(mylock);}))
10 return;
12 frob();
13 _spin_unlock(mylock);
15 if (((_spin_trylock(mylock)?1:0)?1:0))
16 return;
17 frob_somemore();
18 _spin_unlock(mylock);
20 return;
23 * check-name: Locking #3
24 * check-command: smatch sm_locking3.c
26 * check-output-start
27 sm_locking3.c +18 func(13) error: double unlock 'mylock'
28 sm_locking3.c +20 func(15) warn: lock 'mylock' held on line 16 but not on 20.
29 * check-output-end