param_key: fix container of when no struct member is referenced
[smatch.git] / validation / sm_locking2.c
blob0e1c74724198d43264fd07882fcc9981cba13f01
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 void 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;
27 // FIXME: should we warn about start_state/lock mixed returns?
28 return;
31 * check-name: Smatch locking #2
32 * check-command: smatch --project=kernel -DCONFIG_SMP=y sm_locking2.c
34 * check-output-start
35 sm_locking2.c:21 func() error: double unlocked 'mylock' (orig line 17)
36 * check-output-end