1void _spin_lock(int name);
2void _spin_unlock(int name);
3
4int a, b, c;
5
6int func (void)
7{
8	int mylock = 1;
9	int mylock2 = 1;
10	int mylock3 = 1;
11
12	if (a) {
13		return;
14	}
15
16	_spin_lock(mylock);
17	_spin_unlock(mylock);
18
19	if (b) {
20		_spin_unlock(mylock2);
21		return;
22	}
23
24	if (c)
25		_spin_lock(mylock3);
26	return;
27}
28/*
29 * check-name: Smatch locking #1
30 * check-command: smatch --project=kernel --spammy sm_locking.c
31 *
32 * check-output-start
33sm_locking.c:26 func() warn: 'spin_lock:mylock3' is sometimes locked here and sometimes unlocked.
34sm_locking.c:26 func() warn: inconsistent returns 'spin_lock:mylock2'.
35  Locked on:   line 13
36               line 26
37  Unlocked on: line 21
38 * check-output-end
39 */
40