Generate a list of functions that allocate data.
[smatch.git] / validation / sm_locking2.c
bloba20e648140bc24c6fa4961b43432c6ca4316c130
1 void _spin_lock(int name);
2 void _spin_unlock(int name);
3 int _spin_trylock(int name);
5 int a;
6 int b;
7 int func (void)
9 int mylock = 1;
10 int mylock2 = 1;
11 int mylock3 = 1;
13 if (!_spin_trylock(mylock)) {
14 return;
17 _spin_unlock(mylock);
18 _spin_unlock(mylock2);
20 if (a)
21 _spin_unlock(mylock);
22 _spin_lock(mylock2);
24 if (!_spin_trylock(mylock3))
25 return;
26 return;
30 * check-name: Locking #2
31 * check-command: smatch sm_locking2.c
33 * check-output-start
34 sm_locking2.c +21 func(14) error: double unlock 'mylock'
35 sm_locking2.c +26 func(19) warn: lock 'mylock3' held on line 26 but not on 25.
36 * check-output-end