extra: get max correctly
[smatch.git] / validation / sm_locking.c
blobd335ad3b2198b1f3960bba7f6e2fa22287667079
1 _spin_lock(int name);
2 _spin_unlock(int name);
4 int a;
5 int b;
6 int func (void)
8 int mylock = 1;
9 int mylock2 = 1;
10 int mylock3 = 1;
12 if (a) {
13 return;
16 _spin_lock(mylock);
17 _spin_unlock(mylock);
19 if (b) {
20 _spin_unlock(mylock2);
21 return;
24 if (a)
25 _spin_lock(mylock3);
26 return;
29 * check-name: Smatch locking #1
30 * check-command: smatch --project=kernel --spammy sm_locking.c
32 * check-output-start
33 sm_locking.c:26 func() warn: 'spin_lock:mylock3' is sometimes locked here and sometimes unlocked.
34 sm_locking.c:26 func() warn: inconsistent returns spin_lock:mylock2: locked (13,26) unlocked (21)
35 * check-output-end